-
Notifications
You must be signed in to change notification settings - Fork 385
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
Semicolon at end of declaration block in media query produces invalid CSS #4197
Comments
This has been fixed in PHP-CSS-Parser by MyIntervals/PHP-CSS-Parser@134f4e6, but there is no release that includes the commit. I'm not sure how to proceed with this. Should Thoughts @westonruter, @schlessera? |
I would suggest pulling in that specific commit of the repo. Using a patch on a stable release is probably more risky, because we'd need to check all commits in-between to see if the particular commit doesn't depend on other changes introduced between the last stable and that commit. If we lock to this specific commit, and our tests all still pass, I'd say we can leave that until the nest official release. |
@pierlon , can you add QA instructiosn here? |
Bug Description
While reviewing the lakshmi-lite theme (apart of work for #4060), multiple instances of the following error can be observed in the AMP Validator when viewing a post:
I've tracked one cause of the issue to this snippet of CSS in the theme's style.css (line 3063):
As seen above, there's a semicolon after the last declaration block in the media query, and outside of that media query is another declaration block. A similar scenario can be seen on line 219.
When the stylesheet above is processed by
\AMP_Style_Sanitizer
, it produces the following malformed CSS:The issue seems to be with the parsing of the stylesheet in
\AMP_Style_Sanitizer::parse_stylesheet()
. The lingering semicolon is not stripped by PHP_CSS_Parser and is then prepended to the next rule outside of the media query during the splitting of the stylesheet.Expected Behaviour
The lingering semicolon should be stripped and valid CSS should be outputted.
Steps to reproduce
Screenshots
Malformed CSS produced from stylesheet of theme:
Additional context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
amp-custom
inline stylesheet (there should be no semicolons present):Demo
Changelog entry
The text was updated successfully, but these errors were encountered: