svgdotjs / svgdom

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

fix #62: Element.style.setProperty() #63

Closed michael-brade closed 4 years ago

michael-brade commented 4 years ago

This fixes Element.style.setProperty() and kind of makes the unit tests run again. Half of them are still failing, but I added one for setProperty() :-}

The ownerSVGElement access results in an infinite loop, btw, so I disabled that test.

Fuzzyma commented 4 years ago

Thank you! To be fair, I didnt bother about the tests 😅. But jeah - maybe in the future.

What do you think about the new version so far? :)

michael-brade commented 4 years ago

I like it! Especially the switch to ES6. And it seems to be a lot stricter - which is good but made me work a bit :-D

I noticed one little inconsistency: adding styles to <html> adds spaces around CSS properties and values, adding inline styles to an element inside body doesn't do that. I didn't investigate yet (don't care too much ;-)

And I found another bug, stay tuned.

Fuzzyma commented 4 years ago

Hm, I thought I had this whole style thing ruled out once and for all :D.

Yes it is a lot more spec like but at least it is nearer to a browser now. Still many things to do e.g. namespace lookup ends up in infinite loop when the namespace or prefix isnt defined somewhere. The problem: Its the exact code of the spec which leads to this infinite recursion - super strange...

I am not sure if modules were such a good idea since there are problems with supporting them. I was forced to install webpack and create a cs version (and I needed a hack for __dirname because import.meta is not supported by webpack)