diff options
Diffstat (limited to 'node_modules/svgo/plugins/removeScriptElement.js')
| -rw-r--r-- | node_modules/svgo/plugins/removeScriptElement.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/svgo/plugins/removeScriptElement.js b/node_modules/svgo/plugins/removeScriptElement.js new file mode 100644 index 00000000..0e42de4c --- /dev/null +++ b/node_modules/svgo/plugins/removeScriptElement.js @@ -0,0 +1,27 @@ +'use strict'; + +const { detachNodeFromParent } = require('../lib/xast.js'); + +exports.name = 'removeScriptElement'; +exports.description = 'removes <script> elements (disabled by default)'; + +/** + * Remove <script>. + * + * https://www.w3.org/TR/SVG11/script.html + * + * @author Patrick Klingemann + * + * @type {import('./plugins-types').Plugin<'removeScriptElement'>} + */ +exports.fn = () => { + return { + element: { + enter: (node, parentNode) => { + if (node.name === 'script') { + detachNodeFromParent(node, parentNode); + } + }, + }, + }; +}; |
