mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-28 21:24:26 +08:00
Bug: none Change-Id: I9389834400d90beed8df9f28356720031abe9ef1 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6225902 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
30 lines
578 B
JavaScript
30 lines
578 B
JavaScript
'use strict';
|
|
|
|
exports.name = 'removeXMLNS';
|
|
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">
|
|
*
|
|
* @author Ricardo Tomasi
|
|
*
|
|
* @type {import('./plugins-types').Plugin<'removeXMLNS'>}
|
|
*/
|
|
exports.fn = () => {
|
|
return {
|
|
element: {
|
|
enter: (node) => {
|
|
if (node.name === 'svg') {
|
|
delete node.attributes.xmlns;
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|