Skip to content

Commit

Permalink
centralize namespace (fabricjs#6018)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored and Hristo Chakarov committed Jul 27, 2021
1 parent bc181cd commit e762775
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions HEADER.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fabric.rePathCommand = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig;
fabric.reNonWord = /[ \n\.,;!\?\-]/;
fabric.fontPaths = { };
fabric.iMatrix = [1, 0, 0, 1, 0, 0];
fabric.svgNS = 'http://www.w3.org/2000/svg';

/**
* Pixel limit for cache canvases. 1Mpx , 4Mpx should be fine.
Expand Down
5 changes: 2 additions & 3 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,10 @@
y = el.getAttribute('y') || 0,
el2 = elementById(doc, xlink).cloneNode(true),
currentTrans = (el2.getAttribute('transform') || '') + ' translate(' + x + ', ' + y + ')',
parentNode, oldLength = nodelist.length, attr, j, attrs, len;
parentNode, oldLength = nodelist.length, attr, j, attrs, len, namespace = fabric.svgNS;

applyViewboxTransform(el2);
if (/^svg$/i.test(el2.nodeName)) {
var namespace = 'http://www.w3.org/2000/svg';
var el3 = el2.ownerDocument.createElementNS(namespace, 'g');
for (j = 0, attrs = el2.attributes, len = attrs.length; j < len; j++) {
attr = attrs.item(j);
Expand Down Expand Up @@ -625,7 +624,7 @@
(minY * scaleY + heightDiff) + ') ';
parsedDim.viewboxTransform = fabric.parseTransformAttribute(matrix);
if (element.nodeName === 'svg') {
el = element.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'g');
el = element.ownerDocument.createElementNS(fabric.svgNS, 'g');
// element.firstChild != null
while (element.firstChild) {
el.appendChild(element.firstChild);
Expand Down

0 comments on commit e762775

Please sign in to comment.