Nothing Special   »   [go: up one dir, main page]

Skip to content

Commit

Permalink
[css-cascade-5] Define CSSOM Layer APIs #6576
Browse files Browse the repository at this point in the history
  • Loading branch information
mirisuzanne committed Nov 16, 2021
1 parent a64a842 commit 6e8482b
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion css-cascade-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,67 @@ Rolling Back Cascade Layers: the ''revert-layer'' keyword</h4>
but not through any other [=author origin=] [=normal=] declarations.


<h2 id="layer-apis">Layer APIs</h2>

<h3 id='extensions-to-cssimportrule-interface'>
Extensions to the <code>CSSImportRule</code> interface</h3>

The <code>CSSImportRule</code> interface is extended as follows:

<pre class='idl'>
partial interface CSSImportRule {
readonly attribute CSSOMString layerName;

This comment has been minimized.

Copy link
@xiaochengh

xiaochengh Nov 16, 2021

Contributor

We should also clarify that for anonymous layers, layerName is the empty string.

};
</pre>

<h3 id="the-csslayerblockrule-interface">
The <code>CSSLayerBlockRule</code> interface</h3>

The {{CSSLayerBlockRule}} interface represents
the ''@layer'' [[#layer-block|block rule]]:

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

Its <dfn attribute for=CSSLayerBlockRule>name</dfn> attribute represents
the [=layer name=] declared by the at-rule
as written, with white space removed--

This comment has been minimized.

Copy link
@xiaochengh

xiaochengh Nov 16, 2021

Contributor

<layer-name> is already defined as "a period-separated list of <ident> tokens with no intervening white space" (source, see the paragraph above).

So I don't think we need to say anything about white spaces here.

and is an empty string if the layer is anonymous.

<div class="example">
<pre class='lang-css'>
@layer outer {
@layer foo . bar { }
}
</pre>

The {{CSSLayerBlockRule/name}} of the inner ''@layer'' rule
is “foo.bar” (and not “foo . bar” or “outer.foo.bar”).
</div>

<h3 id="the-csslayerstatementrule-interface">
The <code>CSSLayerStatementRule</code> interface</h3>

The {{CSSLayerStatementRule}} interface represents
the ''@layer'' [[#layer-empty|statement]]:

<pre class='idl' export>
[Exposed=Window]
interface CSSLayerStatementRule : CSSRule {
readonly attribute FrozenArray&lt;CSSOMString> nameList;
};
</pre>

Its <dfn attribute for=CSSLayerStatementRule>nameList</dfn> attribute represents
the (possibly empty) list of [=layer names=] declared by the at-rule,

This comment has been minimized.

Copy link
@xiaochengh

xiaochengh Nov 16, 2021

Contributor

The name list of an empty @layer statement should never be empty as per the current spec.

normalized following the same rule as
the {{CSSLayerBlockRule}}’s {{CSSLayerBlockRule/name}} attribute.


<!--
████████ ████████ ██████
██ ██ ██ ██
Expand All @@ -1883,7 +1944,8 @@ Non-trivial changes since the <a href="https://www.w3.org/TR/2021/WD-css-cascade

* Added [[#value-aliasing]] section.
(<a href="https://github.com/w3c/csswg-drafts/issues/6193">Issue 6193</a>)

* Added [[#layer-apis]] section.
(<a href="https://github.com/w3c/csswg-drafts/issues/6576">Issue 6576</a>)

<h3 id="changes-2021-08">
Changes since the 29 August 2021 Working Draft</h3>
Expand Down

1 comment on commit 6e8482b

@xiaochengh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general shape looks good! Just some comments regarding some details.

Please sign in to comment.