svgdotjs / svgdom

Straightforward DOM implementation to make SVG.js run headless on Node.js
MIT License
269 stars 53 forks source link

Window.getComputedStyle.getPropertyValue bug fix #79

Closed biojet1 closed 3 years ago

biojet1 commented 3 years ago

In the object returned by Window.getComputedStyle its getPropertyValue method has a bug It puts the element in a closure variable node. When you update the variable, the value will remain. Try this.

const style = window.getComputedStyle(element);
style.getPropertyValue('fill');
style.getPropertyValue('fill'); // <-- TypeError: Cannot read property 'fill' of undefined

Because now the node variable is Document object with no style property

Fuzzyma commented 3 years ago

good catch!