ded / morpheus

A Brilliant Animator
504 stars 57 forks source link

Fixing issue #45 #46

Open Pauan opened 11 years ago

Pauan commented 11 years ago

I haven't tested all of them, but I believe this should completely fix issue #45

All tests pass, and all the examples seem to work the same.

Rather than hacking up more hardcoded stuff, I went for a more general solution so that almost any CSS value will work.

The general gist of it is that numbers (with or without unit) are given a type of "number", functions are given a type of "function", space-separated values are given a type of "multi", and everything else is given a type of "normal".

And the parsing is designed to be extremely lenient, so that foo(bar, 50qux) is legal. This lets it handle all kinds of values (assuming it works in the browser, of course).

Bonus: discrete values like "font-weight: bold" work now.

One downside is I got rid of morpheus.parseTransform and morpheus.formatTransform. Not sure why those were public in the first place.

Also, apparently trying to set "boxShadow" causes the browser to go into an infinite loop (!) which I think is related to the parser, but that hopefully shouldn't be too hard to fix.