-
Notifications
You must be signed in to change notification settings - Fork 13
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
Shorthand properties don't merge with equivalent non-shorthand properties as expected. #19
Comments
* Use `CSSStyleDeclaration` for `Properties.from_string` (and remove unnecessary test.) * Remove poorly implemented failing test. * Clean up imports for `cssutils`. References GH-19.
This is partially fixed — I updated this in GH-20 this so that There are still a few things to do here:
|
Oops, I forgot about this one. Should do that before releasing the next version. |
Shorthand properties (e.g.
padding
,margin
,font
, etc.) mixed with individual property declarations don't merge as expected, and the resulting property list can violate specificity rules.For instance, this example:
should combine to either of these equivalent forms:
or:
… but right now, that property list ends up merging and resulting in this property list:
or, this property list — since the output order is non-deterministic:
These two different forms have two different results, with their computed results being:
and:
This behavior is explained under "Tricky edge cases" on the MDN documentation.
A good first step would probably be to expand shorthand properties to individual properties upon parsing (ensuring shorthand and individual properties are never merged.) Later, properties could be "compressed" back into shorthand when possible to conserve bytes.
The text was updated successfully, but these errors were encountered: