-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Handle closing parenthesis within data url in transform-styles (#16408) #17146
Conversation
So this PR causes failure on the
|
Found this NxtChg/pieces#3 Props to @lykahb. Is it okay if I credit you for these commits as i'm not really the author? |
@oxyc Thanks, I appreciate this. A while ago I moved from the JS CSS parsers to the native browser parser. But it it's nice to see the bug getting fixed. |
6bc994a
to
18bc584
Compare
I'm not very knowledgeable about the history of this function, but I wonder if it still makes sense for us to have https://github.com/reworkcss/css vendored into Gutenberg rather than included as a package dependency? If it were a dependency then we would get fixes like this simply by bumping the version we depend on. All that aside, this change looks like a perfect candidate for a unit test. Could we add a test to |
This fix has not been merged upstream either and in general the project is quite unmaintained with no releases since September 2018. I can definitely add a unit test here though. |
18bc584
to
d3d2022
Compare
0da0c72
to
e9cae9c
Compare
This might be a PR where the performance impact should be measured but I cant for the life of me get
|
e9cae9c
to
49e7b8a
Compare
Doesnt affect performance. Before:
Average time to load: 11232ms After:
Average time to load: 10914ms |
Noteworthy that I've been running a patched version of Gutenberg with this fix since August 2019 with no issues. Only on one site, but the site pushes it's entire frontend stylesheet through the transform. 964kb in development mode (tailwind before purgecss), 142kb (minified, purged). |
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.
Thanks for updating the PR and the patience here 🙂
I still would love if we made this a package dependency instead of vendoring the library, but let's not let it stop us fixing this bug.
* Internal dependencies | ||
*/ | ||
import traverse from '../traverse'; | ||
import parse from '../ast/parse'; |
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.
I think let's move the describe( 'CSS traverse' )
back into test/traverse.js
and put the describe( 'CSS parse' )
into a new test/parse.js
file.
|
||
describe( 'CSS parse', () => { | ||
it( 'Should handle closing parenthesis within url', () => { | ||
const input = `.a { b: url(")"); d: url(";a"); }`; |
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.
String interpolation isn't necessary.
const input = `.a { b: url(")"); d: url(";a"); }`; | |
const input = '.a { b: url(")"); d: url(";a"); }'; |
Thanks for the review @noisysocks! and sorry for not responding earlier, but shortly after your review, @strarsis came up with a better approach of replacing So I'll close this PR in favor of that one now that I've verified that it would fix my issue |
Fix from reworkcss/css#110
Description
I'm not the actual author of this but it fixes the case when url embedded svgs containing parenthesis are not parsed properly as values. See reworkcss/css#67 (comment). Fixes #16408
How has this been tested?
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: