UNPKG

591 BJavaScriptView Raw
1'use strict';
2
3exports.type = 'perItem';
4
5exports.active = false;
6
7exports.description = 'removes xmlns attribute (for inline svg, disabled by default)';
8
9/**
10 * Remove the xmlns attribute when present.
11 *
12 * @example
13 * <svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg">
14 * ↓
15 * <svg viewBox="0 0 100 50">
16 *
17 * @param {Object} item current iteration item
18 * @return {Boolean} if true, xmlns will be filtered out
19 *
20 * @author Ricardo Tomasi
21 */
22exports.fn = function(item) {
23
24 if (item.isElem('svg') && item.hasAttr('xmlns')) {
25 item.removeAttr('xmlns');
26 }
27
28};
\No newline at end of file