dvtng / jss

JavaScript library for getting and setting CSS stylesheet rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSS property parsing

barneycarroll opened this issue · comments

I'm using JSS to produce transform rules, and it took me a while to work out that the reason it wasn't working with my translate3d(x,y,z)-format transforms was that it was validating input against the CSSOM and failing my passed values. I'm now using matrix(…)-format property values, and it's behaving.

This is an interesting design choice — why parse the input rules? Why not just pass the whole rule in as a string and see what the browser makes of it?

So after reading through the source properly I see there's very granular interaction with the CSSOM, to the point where native objects are queried and set pretty much all the way. Makes a lot of sense (rather than keeping an internal state cache, and just dumping strings into a stylesheet).