[csswg-drafts] [css-page-3] Should `@page` declarations be hoisted? (#11272)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-page-3] Should `@page` declarations be hoisted? ==
Current version of Chrome and FF hoist declarations in `@page`:

```js
const sheet = new CSSStyleSheet
sheet.replaceSync(`

  @page {
    @top-left {
      content: "green";
      color: green;
    }
    color: red;
  }

  style {
    @media {
      color: green;
    }
    color: red;
  }

`)

sheet.cssRules[0].cssText; // @page { color: red; @top-left { ...; color: green; } }
sheet.cssRules[1].cssText; // style { @media { color: green } }
```

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` whose `style` attribute is a `CSSPageDescriptors`?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11272 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 25 November 2024 15:13:12 UTC