mirror of
https://github.com/svg/svgo.git
synced 2025-04-19 10:22:15 +03:00
26 lines
571 B
JavaScript
26 lines
571 B
JavaScript
import { detachNodeFromParent } from '../lib/xast.js';
|
|
|
|
export const name = 'removeStyleElement';
|
|
export const description = 'removes <style> element (disabled by default)';
|
|
|
|
/**
|
|
* Remove <style>.
|
|
*
|
|
* https://www.w3.org/TR/SVG11/styling.html#StyleElement
|
|
*
|
|
* @author Betsy Dupuis
|
|
*
|
|
* @type {import('./plugins-types.js').Plugin<'removeStyleElement'>}
|
|
*/
|
|
export const fn = () => {
|
|
return {
|
|
element: {
|
|
enter: (node, parentNode) => {
|
|
if (node.name === 'style') {
|
|
detachNodeFromParent(node, parentNode);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|