Skip to content

Commit

Permalink
Replace iterating over Object.keys(NodeList) with NodeList.length (
Browse files Browse the repository at this point in the history
…#865)

* Replace iterating over Object.keys(NodeList) with NodeList.length

This seemingly fixes issues with xmldom versions greater than 0.8.8 & up to 0.8.10

* Unpin @xmldom/xmldom

* Update shape.js

---------

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
  • Loading branch information
Ingramz and XhmikosR committed Feb 18, 2024
1 parent 52f6c7f commit ef55f6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/svg-sprite/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ SVGShape.prototype._stripInlineNamespaceDeclarations = function(element, nsMap)
}
}

for (const index of Object.keys(element.childNodes)) {
for (let index = 0; index < element.childNodes.length; index++) {
const child = element.childNodes.item(index);
if (child.nodeType === 1) {
this._stripInlineNamespaceDeclarations(child, parentNsMap);
Expand Down Expand Up @@ -406,7 +406,7 @@ SVGShape.prototype._initSVG = function() {
const children = this.dom.documentElement.childNodes;
const meta = { title: 'title', description: 'desc' };

for (const child of Object.keys(children)) {
for (let child = 0; child < children.length; child++) {
for (const [m, value] of Object.entries(meta)) {
if (value === children.item(child).localName) {
this[m] = children.item(child);
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"@resvg/resvg-js": "^2.6.0",
"@xmldom/xmldom": "0.8.8",
"@xmldom/xmldom": "^0.8.10",
"async": "^3.2.5",
"css-selector-parser": "^1.4.1",
"csso": "^5.0.5",
Expand Down

0 comments on commit ef55f6b

Please sign in to comment.