-
Notifications
You must be signed in to change notification settings - Fork 143
Fix #584 text-shadow with multiple values#1019
Conversation
outoftime
commented
Sep 6, 2017
@jwang1919 so I think we might be at a point where we should just contribute a fix upstream to PrettyCSS. We’ve done so before and the process was pretty painless—the library is well-factored and it’s easy to add tests and such.
I would lean in that direction because PrettyCSS itself has a full tokenizer and lexer built in, so adding support for a given syntactic construct is much more robust and expressive than trying to work around a parser error using regular expressions. (I admit to being a little lost looking at the regexps you introduce here, and I consider myself reasonably competent with regexps).
WDYT?
@outoftime Yeah that sounds like a better option to me as well.
I'll revisit this branch once I submit the PR and it gets accepted in the PrettyCSS library.
The regexp was a difficult come up with, but not too hard to interpret.
It looks for any strings that has a comma followed by another comma with any number of blank spaces in between.
, // look for comma
( // start lookahead assertion
?= // positive assertion, only match for these things
\s* // zero to many blank spaces
, // a comma
) // close lookahead assertion
outoftime
commented
Sep 7, 2017
@jwang1919 gotcha. yeah I’ve only worked with lookaheads a couple times, that’s what threw me off.
FWIW, we don’t necessarily need to wait for PrettyCSS to integrate your patch—we could temporarily target https://github.com/popcodeorg/PrettyCSS (which I think I did in the past while waiting for PRs to get merged)
jwang1919
commented
Sep 7, 2017
Okay, made the changes and submitted PRs to both the original branch and the popcode fork. Once those are dealt with, I can change this branch's code.
d7ef859 to
75e4f2a
Compare
75e4f2a to
d1c0731
Compare
@outoftime When possible, please review again. I have pushed the fix onto the PrettyCSS library (the maintainer merged it pretty quickly) and I've updated the PrettyCSS library.
@outoftime
outoftime
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sick!! Awesome work on the upstream PR!
Uh oh!
There was an error while loading. Please reload this page.
Fixes bug #584
Gave commas between CSS parenthesis statements like
rgbaleeway in the PrettyCSS validation.I found that doing so inadvertently created another bug where multiple commas would flag as valid. I added another check to deal with this as well as added the requisite validations in the test case.