Skip to content

[css-page-3] Should @page declarations be hoisted? #11272

Open
@cdoublev

Description

@cdoublev

Current version of Chrome and FF hoist declarations in @page:

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 } color: red; }

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions