-
Notifications
You must be signed in to change notification settings - Fork 711
[css-page-3] Should @page
declarations be hoisted?
#11272
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
Comments
Seems like a good idea in order to make behavior consistent / predictable. /ping @andruud |
So the question might be whether |
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
cc @mstensho I agree that not hoisting would be more consistent, especially if it actually matters for the behavior.
I do think we're going to need a
Definitely inappropriate. It's currently specced to use |
It doesn't matter for the behavior. Note that the spec recommends that https://drafts.csswg.org/css-page-3/#margin-at-rules
As such, it makes slightly more sense to hoist, than not to hoist. But it shouldn't matter. Specificity isn't an issue here, since what's in
See https://drafts.csswg.org/css-page-3/#page-model and https://drafts.csswg.org/css-page-3/#page-properties |
It does not matter for the rendering behavior as long as conditional rules are not allowed in @page {
@media print and (width > 21cm) {
margin: 3cm; /* Applies only if declarations are hoisted */
}
margin: 1cm;
} Now this can remain unspecified and change later if conditional rules are allowed, which would only change the CSSOM behavior. |
Also fixes CSSNestedDeclarations and CSSFontFeatureValuesRule (follow-up of fc5f64c). CSS*Declarations represent declarations appearing after a rule and expose a style attribute as a subclass of CSSStyleDeclaration, defined with the descriptors or properties allowed in the parent rule. CSSPageDeclarations is unspecified so this is a speculation on the outcome of w3c/csswg-drafts#11272. CSSFontFeatureValuesRules hoist declarations for font-display, which will presumably be removed (w3c/csswg-drafts#2973).
Current version of Chrome and FF hoist declarations in
@page
:If I am not mistaken,
@page
(with no page selector) and margin rules have the same specificity. So this might be unexpected, like in style rules.Should they be wrapped in
CSSNestedDeclarations
whosestyle
attribute is aCSSPageDescriptors
?The text was updated successfully, but these errors were encountered: