-
Notifications
You must be signed in to change notification settings - Fork 6
Handle the closing brace for parsing at rule. Make enums as consts. #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
Prevent problems with closure running after typescript.
This fixes two incompatibilities between shady-css-parser and browsers. 1. If the css is missing a closing brace like div { color:red then Shady drops the last rule, but browsers keep it. 2. If a css ruleset has an empty selector like /*empty*/ { color: red } div { color: blue } then Shady discards the { } and produces this: color:red;div { color: blue; } which has an entirely different meaning. Browsers parse the empty-selector block, but then ignore it as invalid. For this case, we could either make Shady keep the block or drop the block. I decided to keep the block, because Shady generally passes through many other not-quite-valid css text that browsers would ignore.
fix handling of some malformed css
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
This fixes the scenario where extra semicolons are immediately followed (without whitespace) by a boundary token such as '}'. For the ruleset: .foo{bar:baz;;}div .qux{vim:fet;} Shady treats the first `}' as an extra token and adds div .qux rule under the .foo selector.
Fix parsing for minified css with extra semicolons
The test case that is failing currently is
.foo{font-weight:300;@charset "UTF-8"}.bar{width:100vw;}
.Expected result: .foo{font-weight:300;@charset "UTF-8";}.bar{width:100vw;}