mirror of
https://github.com/svg/svgo.git
synced 2025-04-27 00:08:49 +03:00
- cleanupAttrs - convertEllipseToCircle - removeDesc - removeDoctype - removeEmptyText - removeMetadata - removeRasterImages - removeScriptElement - removeStyleElement - removeTitle - removeXMLProcInst
28 lines
516 B
JavaScript
28 lines
516 B
JavaScript
'use strict';
|
|
|
|
const { detachNodeFromParent } = require('../lib/xast.js');
|
|
|
|
exports.type = 'visitor';
|
|
exports.active = false;
|
|
exports.description = 'removes <script> elements (disabled by default)';
|
|
|
|
/**
|
|
* Remove <script>.
|
|
*
|
|
* https://www.w3.org/TR/SVG11/script.html
|
|
*
|
|
*
|
|
* @author Patrick Klingemann
|
|
*/
|
|
exports.fn = () => {
|
|
return {
|
|
element: {
|
|
enter: (node, parentNode) => {
|
|
if (node.name === 'script') {
|
|
detachNodeFromParent(node, parentNode);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|