You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that iterating on an element's style iterates 0 times while it clearly shows that it has content.
After explicitly reading a property from the style or stringifying it would iterate properly on the contents of the style.
Reproduction:
constlinkedom=require('linkedom');constparser=newlinkedom.DOMParser();conste=parser.parseFromString('<html><body><div style=" display: flex ;"></div></body></html>','text/html');constdivWithStyle=e.body.firstChild;console.log(divWithStyle.hasAttribute('style'));// trueconsole.log(divWithStyle.getAttribute('style'));// ' display: flex ;'console.log(divWithStyle.style);// CSSStyleDeclaration(0) [Map] {}console.log([...divWithStyle.style]);// [] <------- problemconsole.log(Array.from(divWithStyle.style));// [] <------- problemdivWithStyle.style.toString();// divWithStyle.style.display; works as wellconsole.log([...divWithStyle.style]);// ['display'] <------- worksconsole.log(Array.from(divWithStyle.style));// ['display'] <------- works
Verified on version 0.14.25 and 0.15.2
workaround, perform a toString() on the style before iterating on it
The text was updated successfully, but these errors were encountered:
It seems that iterating on an element's style iterates 0 times while it clearly shows that it has content.
After explicitly reading a property from the style or stringifying it would iterate properly on the contents of the style.
Reproduction:
Verified on version 0.14.25 and 0.15.2
workaround, perform a
toString()
on the style before iterating on itThe text was updated successfully, but these errors were encountered: