source: trip-planner-front/node_modules/svgo/plugins/removeScriptElement.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 601 bytes
Line 
1'use strict';
2
3const { detachNodeFromParent } = require('../lib/xast.js');
4
5exports.name = 'removeScriptElement';
6exports.type = 'visitor';
7exports.active = false;
8exports.description = 'removes <script> elements (disabled by default)';
9
10/**
11 * Remove <script>.
12 *
13 * https://www.w3.org/TR/SVG11/script.html
14 *
15 * @author Patrick Klingemann
16 *
17 * @type {import('../lib/types').Plugin<void>}
18 */
19exports.fn = () => {
20 return {
21 element: {
22 enter: (node, parentNode) => {
23 if (node.name === 'script') {
24 detachNodeFromParent(node, parentNode);
25 }
26 },
27 },
28 };
29};
Note: See TracBrowser for help on using the repository browser.