Skip to content

[css-cascade-7] @sheet proposal #11509 #11980

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 19 additions & 25 deletions css-cascade-7/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Shortname: css-cascade
Level: 7
Status: ED
Prepare for TR: no
Work Status: Revising
Work Status: Exploring
Group: csswg
ED: https://drafts.csswg.org/css-cascade-7/
Previous Version: https://www.w3.org/TR/2021/WD-css-cascade-6-20211221/
Expand Down Expand Up @@ -73,13 +73,13 @@ Stylesheet</h2>
<li>An instance of file with the <a href="https://www.w3.org/TR/css-cascade-5/#content-type">CSS Style Sheet Content-Type</a>, embedded within a document.
<li>A collection of CSS rules within a document.
<li><a href="https://www.w3.org/TR/cssom/#the-stylesheet-interface">CSSOM Stylesheet</a> objects.
<li>Any of the above may be subdivided into <dfn>named stylesheet</dfn> with the ''@sheet'' rule.
<li>Any of the above may be subdivided into a <dfn>named stylesheet</dfn> with the ''@sheet'' rule.
</ol>

A <dfn>sheet-name</dfn> is a string identifying
inner named sheets within a stylesheet.
inner [=named stylesheet=]s within a stylesheet.

Syntactically, a stylesheet must include an explicit [=sheet-name=], and is represented
Syntactically, a [=named stylesheet=] must include an explicit [=sheet-name=], and is represented
by the <<sheet-name>> in ''@sheet'' and ''@import'' rules,
which is a single <<ident>> token:

Expand All @@ -89,9 +89,10 @@ Stylesheet</h2>

<h3 id="at-ruledef-sheet">
Named Stylesheets: the `@sheet` block at-rule</h3>
A [=named stylesheet=] may be declared by using
an [[#at-ruledef-sheet|@sheet block at-rule]],
assigning its child style rules into that sheet.

The ''@sheet'' [=block at-rule=]
assigns its style rules to a particular [=named stylesheet=].
This sheet-assignment syntax is:

<pre class='prod'>
Expand All @@ -105,7 +106,7 @@ Named Stylesheets: the `@sheet` block at-rule</h3>
with a false condition.

Note: This means that rules within an ''@sheet'' block are not applied
until their [=named stylesheet=] is explicitly embedded into a document.
until their [=named stylesheet=] is explicitly imported into another context.

<div class=example>
<pre class=lang-css>
Expand All @@ -117,18 +118,11 @@ until their [=named stylesheet=] is explicitly embedded into a document.
&lt;h1>Sample text&lt;/h1>
</pre>
In this example, the ''h1'' tag does not have the maroon color applied, as the ''@sheet''
named "framework" was not explicitly embedded into the document.
named "framework" was not explicitly imported into another context.
</div>

''@sheet'' [=block at-rules=] may not be nested within any other CSS rules.

<h3 id="sheet-declaration">
Declaring Named Stylesheets</h3>

A [=named stylesheet=] may be declared by using
an [[#at-ruledef-sheet|@sheet block at-rule]],
assigning its child style rules into that sheet.

<h3 id="at-ruledef-import-from">
Importing Specific Named Stylesheets: the ''from'' Keyword</h3>

Expand All @@ -145,7 +139,7 @@ Importing Specific Named Stylesheets: the ''from'' Keyword</h3>
<<media-query-list>>?</pre>

where:
* the optional <<sheet-name-list>> imports only the named sheet(s)
* the optional <<sheet-name-list>> imports only the stylesheet(s)
with names matching [=named stylesheet=]s from the provided URL
in the order they are listed.

Expand Down Expand Up @@ -204,7 +198,7 @@ Importing Specific Named Stylesheets: the ''from'' Keyword</h3>
</pre>
</div>

If a <url-string> is provided,
If a <<url-string>> is provided,
it must be interpreted as a <<url>> with the same value.

<div class="example">
Expand All @@ -230,21 +224,21 @@ Importing Specific Named Stylesheets: the ''from'' Keyword</h3>

<h2 id="sheet-apis">Sheet APIs</h2>

<h3 id="the-csssheetblockrule-interface">
The <code>CSSSheetBlockRule</code> interface</h3>
<h3 id="the-CSSSheetRule-interface">
The <code>CSSSheetRule</code> interface</h3>

The {{CSSSheetBlockRule}} interface represents
The {{CSSSheetRule}} interface represents
the ''@sheet'' [[#at-ruledef-sheet|block rule]]:

<pre class='idl' export>
[Exposed=Window]
interface CSSSheetBlockRule : CSSGroupingRule {
interface CSSSheetRule : CSSGroupingRule {
readonly attribute CSSOMString name;
};
</pre>

Its <dfn attribute for=CSSSheetBlockRule>name</dfn> attribute represents
the <<sheet-name>> declared by the at-rule itself.
Its <dfn attribute for=CSSSheetRule>name</dfn> attribute represents
the <<sheet-name>> declared by the [[#at-ruledef-sheet|@sheet block at-rule]].

<h3 id="the-sheetnamelist-interface">The <code>SheetNameList</code> Interface</h3>

Expand Down Expand Up @@ -272,7 +266,7 @@ Extensions to the <code>CSSImportRule</code> interface</h3>
</pre>

Its <dfn attribute for=CSSImportRule>sheetNames</dfn> attribute represents
a list of <<sheet-name>> definitions declared by the at-rule itself in the order
a list of <<sheet-name>> definitions declared by the [[#at-ruledef-sheet|@sheet block at-rule]] in the order
they are listed.

Its <dfn attribute for=CSSImportRule>namedStyleSheets</dfn> attribute represents the list
Expand Down Expand Up @@ -302,7 +296,7 @@ Additions Since Level 6</h3>

* The definition of a [=stylesheet=].
* The ''@sheet'' rule for subdividing stylesheets.
* CSSOM definition for {{CSSSheetBlockRule}}.
* CSSOM definition for {{CSSSheetRule}}.
* CSSOM definition for {{SheetNameList}}.
* Extended CSSOM definition for {{CSSImportRule}}.

Expand Down