-
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
Error while traversing the CSS: property missing ':' #19930
Comments
Can you provide a bigger excerpt of your CSS to reproduce the issue, please? I am running the following and it works as expected: const input = `h1{color:red;background:url("data:image/svg+xml;charset=utf-8,%3Csvg")}`;
const output = traverse( input, ( node ) => {
if ( node.type === 'rule' ) {
return {
...node,
selectors: node.selectors.map(
( selector ) => 'namespace ' + selector
),
};
}
return node; |
I get the same issue and I also have inline SVGs in my CSS. If I remove these, the issue is resolved. +1 that we should be able to use valid CSS in our themes without the editor styles breaking. |
There is a PR for reimplementing the CSS wrapping using a CSS library. However, some issues stalled the progress for now. |
Any news on this? Also @strarsis could you reference the PR you are talking about? |
Today I tried escaping the single quotes (with |
@keithdevon: Are you doing this in an automated fashion, like using a PostCSS plugin? |
@oxyc: Here is a proof of concept for parsing and modifying the styles directly with native browser APIs: No styles are applied before processing is finished (no flash of select-unwrapped styles) and the function accepts an input CSS string and returns an output CSS string. |
FYI I just got a similar error trying to use @container {} in my editor stylesheet. |
Describe the bug
When using production (minified), valid CSS styles also as editor styles,
the Gutenberg editor script has issues parsing it, no editor styles are applied.
Error while traversing the CSS: Error: [...]: property missing ':'
.According to the line and column number, the parser has issues with the
=
for inline SVG:This is valid CSS and works in all modern browsers, it is also valid for the W3C CSS validator.
To reproduce
Steps to reproduce the behavior:
add_editor_style
that encodes a SVG usingdata:image/svg+xml;...
.Ctrl
+F
in Developer Console DOM view and search for text/selectors in the theme style file.In Console you can find the error
Error while traversing the CSS: Error: [...]: property missing ':'
.Expected behavior
The CSS parser should be able to parse all valid, working, usual CSS.
The text was updated successfully, but these errors were encountered: