jotform / css.js

A lightweight, battle tested, fast, CSS parser in JavaScript
https://medium.com/jotform-form-builder/writing-a-css-parser-in-javascript-3ecaa1719a43
MIT License
426 stars 63 forks source link

Updated cssKeyframeRegex to fix bug that removed chunks of CSS preceding "keyframes" #5

Closed mortenson closed 8 years ago

mortenson commented 9 years ago

This PR updates the cssKeyframeRegex to fix a bug where occurrences of "keywords" would cause a significant chunk of CSS to be improperly removed. You can see this in the example below:

$ css = new cssjs();
$ css.parseCSS('@font-family{source:url("")}keyframes foo{ foo{top: 0px;} }')
$ foo[0].selector
 "@keyframes"
$ foo[0].styles
 "@font-family{source:url("")}keyframes foo{ foo{top: 0px;} }"
$ foo[0].type
 "keyframes"
kemaldaggen commented 9 years ago

Thanks for the Pull request. It seems not to be breaking the unit tests. I'll investigate the issue and accept it in couple of days!

mortenson commented 9 years ago

Have you gotten a chance to look at this @cettox? Thanks!

mortenson commented 8 years ago

Any update @cettox? This will need to be manually merged at this point but is a pretty minor change.

kemaldaggen commented 8 years ago

Sorry for waiting you so long, thanks for the contribution!