mirror of
https://github.com/svg/svgo.git
synced 2025-08-07 15:22:54 +03:00
Merge pull request #164 from silentroach/feature-remove-title
new plugin: removeTitle (disabled by default, close #159)
This commit is contained in:
22
plugins/removeTitle.js
Normal file
22
plugins/removeTitle.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
exports.type = 'perItem';
|
||||
|
||||
exports.active = false;
|
||||
|
||||
/**
|
||||
* Remove <title>.
|
||||
* Disabled by default cause it may be used for accessibility.
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
|
||||
*
|
||||
* @param {Object} item current iteration item
|
||||
* @return {Boolean} if false, item will be filtered out
|
||||
*
|
||||
* @author Igor Kalashnikov
|
||||
*/
|
||||
exports.fn = function(item) {
|
||||
|
||||
return !item.isElem('title');
|
||||
|
||||
};
|
10
test/plugins/removeTitle.01.svg
Normal file
10
test/plugins/removeTitle.01.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>...</title>
|
||||
<g/>
|
||||
</svg>
|
||||
|
||||
@@@
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<g/>
|
||||
</svg>
|
After Width: | Height: | Size: 143 B |
Reference in New Issue
Block a user