Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
623 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | exports.name = 'removeXMLNS';
|
---|
| 4 |
|
---|
| 5 | exports.type = 'perItem';
|
---|
| 6 |
|
---|
| 7 | exports.active = false;
|
---|
| 8 |
|
---|
| 9 | exports.description =
|
---|
| 10 | 'removes xmlns attribute (for inline svg, disabled by default)';
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | * Remove the xmlns attribute when present.
|
---|
| 14 | *
|
---|
| 15 | * @example
|
---|
| 16 | * <svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg">
|
---|
| 17 | * ↓
|
---|
| 18 | * <svg viewBox="0 0 100 50">
|
---|
| 19 | *
|
---|
| 20 | * @param {Object} item current iteration item
|
---|
| 21 | * @return {Boolean} if true, xmlns will be filtered out
|
---|
| 22 | *
|
---|
| 23 | * @author Ricardo Tomasi
|
---|
| 24 | */
|
---|
| 25 | exports.fn = function (item) {
|
---|
| 26 | if (item.type === 'element' && item.name === 'svg') {
|
---|
| 27 | delete item.attributes.xmlns;
|
---|
| 28 | }
|
---|
| 29 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.