- Refactoring: Avoid redundant use of *AttributeNS methods with

`null` value; just use *Attribute methods without namespace
This commit is contained in:
Brett Zamir
2018-10-23 18:13:36 +08:00
parent f4bbd34d34
commit 2835ec11b6
20 changed files with 98 additions and 96 deletions

View File

@@ -15155,12 +15155,12 @@
if (iswebkit) {
delayedStroke = function delayedStroke(ele) {
var _stroke = ele.getAttributeNS(null, 'stroke');
var _stroke = ele.getAttribute('stroke');
ele.removeAttributeNS(null, 'stroke'); // Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
ele.removeAttribute('stroke'); // Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
if (_stroke !== null) setTimeout(function () {
ele.setAttributeNS(null, 'stroke', _stroke);
ele.setAttribute('stroke', _stroke);
}, 0);
};
}
@@ -15686,8 +15686,8 @@
y2 = xya.y;
}
shape.setAttributeNS(null, 'x2', x2);
shape.setAttributeNS(null, 'y2', y2);
shape.setAttribute('x2', x2);
shape.setAttribute('y2', y2);
break;
}
@@ -15741,7 +15741,7 @@
rad = snapToGrid(rad);
}
shape.setAttributeNS(null, 'r', rad);
shape.setAttribute('r', rad);
break;
}
@@ -15759,9 +15759,9 @@
cy = snapToGrid(cy);
}
shape.setAttributeNS(null, 'rx', Math.abs(x - cx));
shape.setAttribute('rx', Math.abs(x - cx));
var ry = Math.abs(evt.shiftKey ? x - cx : y - cy);
shape.setAttributeNS(null, 'ry', ry);
shape.setAttribute('ry', ry);
break;
}
@@ -15778,7 +15778,7 @@
case 'fhpath':
{
// dAttr += + realX + ',' + realY + ' ';
// shape.setAttributeNS(null, 'points', dAttr);
// shape.setAttribute('points', dAttr);
end.x = realX;
end.y = realY;
@@ -22004,7 +22004,7 @@
var svgroot = document.createElementNS(svgns, 'svg'); // Per https://www.w3.org/TR/xml-names11/#defaulting, the namespace for
// attributes should have no value.
svgroot.setAttributeNS(null, 'viewBox', [0, 0, iconW, iconH].join(' '));
svgroot.setAttribute('viewBox', [0, 0, iconW, iconH].join(' '));
var svg = elem.getElementsByTagNameNS(svgns, 'svg')[0]; // Make flexible by converting width/height to viewBox
var w = svg.getAttribute('width');