Files
react-native-devtools-frontend/node_modules/svgo/plugins/removeXMLNS.js
T
Tim van der Lippe b693eb34d5 Update remaining NPM dependencies
DISABLE_THIRD_PARTY_CHECK=NPM fix
R=jacktfranklin@chromium.org

Bug: none
Change-Id: I41baa3294f88b7e4463fdc580c050932c5abe40e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3372932
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
2022-01-07 14:42:53 +00:00

31 lines
666 B
JavaScript

'use strict';
exports.name = 'removeXMLNS';
exports.type = 'perItem';
exports.active = false;
exports.description =
'removes xmlns attribute (for inline svg, disabled by default)';
/**
* Remove the xmlns attribute when present.
*
* @example
* <svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg">
* ↓
* <svg viewBox="0 0 100 50">
*
* @param {Object} item current iteration item
* @return {Boolean} if true, xmlns will be filtered out
*
* @author Ricardo Tomasi
*/
exports.fn = function (item) {
if (item.type === 'element' && item.name === 'svg') {
delete item.attributes.xmlns;
delete item.attributes['xmlns:xlink'];
}
};