1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00
Files
svgo/plugins/removeTitle.js
Seth Falco a9df915d1d fix: dont trim pre elements (#1796)
Includes pre in the array of text elements in _collections.js so that we don't trim whitespace on them, which effects rendering.
2023-11-12 11:56:39 +00:00

28 lines
536 B
JavaScript

'use strict';
const { detachNodeFromParent } = require('../lib/xast.js');
exports.name = 'removeTitle';
exports.description = 'removes <title>';
/**
* Remove <title>.
*
* https://developer.mozilla.org/docs/Web/SVG/Element/title
*
* @author Igor Kalashnikov
*
* @type {import('./plugins-types').Plugin<'removeTitle'>}
*/
exports.fn = () => {
return {
element: {
enter: (node, parentNode) => {
if (node.name === 'title') {
detachNodeFromParent(node, parentNode);
}
},
},
};
};