jsdom / cssstyle

A Node.js implementation of the CSS Object Model CSSStyleDeclaration interface
MIT License
109 stars 70 forks source link

Added more Flex-related styles. #72

Closed step-off closed 5 years ago

step-off commented 6 years ago

Hello there! First of all, thank you for awesome work!

By this PR I'm adding some more flex styles: flex-grow, flex-shrink, flex-basis and flex shorthand.

There is nothing special in this changes, but I'd like to clearify one moment. When I added flex shorthand and write tests on it, none of them was 'green'. It turns out, that setting flex shorthand value, for example, 0 1 250px would give output 1 1 250px. Flex-grow is being reassigned by flex-shrink value, because it is absolutly valid for it and their type and possible values are identical. To resolve this confusion I decided to pass shorhand part's index as second parameter in subprop isValid function while runnig shorthandParser. Now it works fine. Tests prove it.

Nonetheless, if you'll see this solution as not clear enough, I'll gladly fix or rewrite this according to your advice :)

Hope it helps somehow. Best regards

jsakas commented 5 years ago

Thanks for the PR!

Moved to https://github.com/jsakas/CSSStyleDeclaration/pull/80 so I could resolve conflicts.