Skip to content

Fix #584 text-shadow with multiple values #1019

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

Merged
merged 1 commit into from
Sep 14, 2017

Conversation

jwang1919
Copy link
Contributor

@jwang1919 jwang1919 commented Sep 5, 2017

Fixes bug #584

Gave commas between CSS parenthesis statements like rgba leeway 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.

@outoftime
Copy link
Contributor

@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?

@jwang1919
Copy link
Contributor Author

jwang1919 commented Sep 7, 2017

@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
Copy link
Contributor

@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
Copy link
Contributor Author

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.

@jwang1919 jwang1919 force-pushed the #584-shorthand-css-bug branch from d7ef859 to 75e4f2a Compare September 9, 2017 01:44
@jwang1919 jwang1919 force-pushed the #584-shorthand-css-bug branch from 75e4f2a to d1c0731 Compare September 9, 2017 01:45
@jwang1919
Copy link
Contributor Author

jwang1919 commented Sep 9, 2017

@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.

Copy link
Contributor

@outoftime outoftime left a 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!

@outoftime outoftime merged commit 33ff32d into popcodeorg:master Sep 14, 2017
@jwang1919 jwang1919 deleted the #584-shorthand-css-bug branch September 14, 2017 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants