Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #584 text-shadow with multiple values#1019

Merged
outoftime merged 1 commit into
popcodeorg:master from
jwang1919:#584-shorthand-css-bug
Sep 14, 2017
Merged

Fix #584 text-shadow with multiple values #1019
outoftime merged 1 commit into
popcodeorg:master from
jwang1919:#584-shorthand-css-bug

Conversation

@jwang1919

@jwang1919 jwang1919 commented Sep 5, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
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 commented Sep 7, 2017
edited
Loading

Copy link
Copy Markdown
Contributor Author

@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

Copy link
Copy Markdown
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)

Copy link
Copy Markdown
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 commented Sep 9, 2017
edited
Loading

Copy link
Copy Markdown
Contributor Author

@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

Copy link
Copy Markdown
Contributor

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

Reviewers

@outoftime outoftime outoftime approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /