-
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
Remove all instances of !important in CSS. #927
Comments
@kopepasah is this not already being done? See: Did you find a case where these aren't stripping the |
Actually, I'd improve both lines of code with a replace that doesn't break functionality. We've released an npm plugin for this at https://www.npmjs.com/package/replace-important, but really, all you need to do is:
|
@pbakaus agreed. But we need a PHP-based CSS parser to do that, actually as noted above one of those lines: @kopepasah I can see that |
@westonruter yes, that should catch it. I am seeing it when activating modules in Jetpack. In addition to |
@westonruter ah, didn't see that comment! Good call, and thanks for filing the additional issue. One additional thought: I'd much rather render invalid AMP pages than broken AMP pages. Stripping out !important blindly will produce glitches across the board, and I'd rather not run with that strategy. The plugin should always produce close to 100% predictable results. |
@pbakaus agreed. @westonruter since we are combining all the styles, it makes debugging a little difficult and sometimes hard to tell where the invalid CSS originated. How about adding information to the AMP debugger or throw a warning for invalid styles while in |
…le_Sanitizer Run !important and overflow removal logic on inlined external stylesheets as well as style elements and style attributes. See #927.
When parsing the CSS, it would be good to remove all instances of
!important
as these invalidate the AMP markup.The text was updated successfully, but these errors were encountered: