Skip to content

Commit 9cc48c0

Browse files
committed
[css-nesting-1] Drop the CSSNestRule interface, add an issue about whether it goes on CSSStyleRule or CSSStyleDeclaration. w3c#7831
1 parent 87cdee9 commit 9cc48c0

File tree

1 file changed

+17
-80
lines changed

1 file changed

+17
-80
lines changed

css-nesting-1/Overview.bs

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Abstract: This module introduces the ability to nest one style rule inside anoth
1414

1515
<pre class=link-defaults>
1616
spec:css-color-4; type:property; text:color
17+
spec:css-values-4; type:dfn; text:identifier
1718
spec:cssom-1; type:dfn;
1819
text:child css rules
1920
text:specified order
@@ -497,7 +498,7 @@ Syntax {#syntax}
497498
Nesting Conditional Rules {#conditionals}
498499
-----------------------------------------
499500

500-
In addition to ''@nest'' rules and [=directly nested=] style rules,
501+
In addition to [=nested style rules=],
501502
this specification allows <dfn export>nested conditional group rules</dfn>
502503
inside of [=style rules=].
503504

@@ -509,7 +510,6 @@ Nesting Conditional Rules {#conditionals}
509510
applying to the same elements as the parent rule
510511
(when the [=conditional group rule=] matches)
511512
* [=Style rules=] are [=nested style rules=],
512-
and so must have [=nest-prefixed=] selectors,
513513
with their [=nesting selector=] taking its definition
514514
from the nearest ancestor [=style rule=].
515515

@@ -915,84 +915,21 @@ into the [=CSSRule/child CSS rules=] at <var>index</var>.
915915
The <dfn method for=CSSStyleRule>deleteRule(<var>index</var>)</dfn> method
916916
must [=remove a CSS rule=] from the [=CSSRule/child CSS rules=] at <var>index</var>.
917917

918+
Note: Serialization of {{CSSStyleRule}} with nested rules
919+
are already well-defined by [[CSSOM]],
920+
via [=serialize a CSS rule=].
918921

919-
The {{CSSNestingRule}} Interface {#cssom-nesting}
920-
-------------------------------------------------
922+
<div class=issue>
923+
Whether we attach .cssRules to CSSStyleRule,
924+
as described here,
925+
or to CSSStyleDeclaration
926+
(to be consistent with future work
927+
allowing `style` attributes to have nested rules)
928+
is still an open question.
921929

922-
The {{CSSNestingRule}} interfaces represents a ''@nest'' rule:
930+
Also, attaching it to .style
931+
means existing code setting <code>rule.style=""</code>
932+
and expecting
923933

924-
<pre class=idl>
925-
[Exposed=Window]
926-
interface CSSNestingRule : CSSRule {
927-
attribute CSSOMString selectorText;
928-
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
929-
[SameObject] readonly attribute CSSRuleList cssRules;
930-
unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
931-
undefined deleteRule(unsigned long index);
932-
};
933-
</pre>
934-
935-
The <dfn attribute for=CSSNestingRule>selectorText</dfn> attribute,
936-
on getting,
937-
must return the result of [=serialize a group of selectors|serializing=]
938-
the associated [=selector list=].
939-
On setting the {{CSSStyleRule/selectorText}} attribute these steps must be run:
940-
941-
1. Run the <a>parse a group of selectors</a> algorithm on the given value.
942-
2. If the algorithm returns a non-null value replace the associated [=selector list=] with the returned value.
943-
3. Otherwise, if the algorithm returns a null value, do nothing.
944-
945-
The <dfn attribute for=CSSNestingRule>style</dfn> attribute
946-
must return a {{CSSStyleDeclaration}} object for the style rule,
947-
with the following properties:
948-
949-
<dl>
950-
: [=CSSStyleDeclaration/computed flag=]
951-
:: Unset.
952-
: [=CSSStyleDeclaration/declarations=]
953-
:: The declared declarations in the rule, in <a>specified order</a>.
954-
: [=CSSStyleDeclaration/parent CSS rule=]
955-
:: The [=this=] object.
956-
: [=CSSStyleDeclaration/owner node=]
957-
:: Null.
958-
</dl>
959-
960-
The <dfn attribute for=CSSNestingRule>cssRules</dfn> attribute
961-
must return a {{CSSRuleList}} object for the [=CSSRule/child CSS rules=].
962-
963-
The <dfn method for=CSSNestingRule>insertRule(<var>rule</var>, <var>index</var>)</dfn> method
964-
must return the result of
965-
invoking [=insert a CSS rule=] <var>rule</var>
966-
into the [=CSSRule/child CSS rules=] at <var>index</var>.
967-
968-
The <dfn method for=CSSNestingRule>deleteRule(<var>index</var>)</dfn> method
969-
must [=remove a CSS rule=] from the [=CSSRule/child CSS rules=] at <var>index</var>.
970-
971-
To serialize a {{CSSNestingRule}}:
972-
return the result of the following steps:
973-
974-
<ol>
975-
<li>Let |s| initially be the string "<code>@nest</code>" followed by a single SPACE (U+0020).
976-
<li>Append to |s| the result of performing <a>serialize a group of selectors</a> on the rule's associated selectors,
977-
followed by the string "<code> {</code>", i.e., a single SPACE (U+0020), followed by LEFT CURLY BRACKET (U+007B).
978-
<li>Let |decls| be the result of performing <a>serialize a CSS declaration block</a> on the rule's associated declarations, or null if there are no such declarations.
979-
<li>Let |rules| be the result of performing [=serialize a CSS rule=] on each rule in the rule's {{CSSStyleRule/cssRules}} list, or null if there are no such rules.
980-
<li>If |decls| and |rules| are both null, append " }" to |s| (i.e. a single SPACE (U+0020) followed by RIGHT CURLY BRACKET (U+007D)) and return |s|.
981-
<li>If |rules| is null:
982-
<ol>
983-
<li>Append a single SPACE (U+0020) to |s|
984-
<li>Append |decls| to |s|
985-
<li>Append " }" to |s| (i.e. a single SPACE (U+0020) followed by RIGHT CURLY BRACKET (U+007D)).
986-
<li>Return |s|.
987-
</ol>
988-
<li>Otherwise:
989-
<ol>
990-
<li>If |decls| is not null, prepend it to |rules|.
991-
<li>For each |rule| in |rules|:
992-
<ol>
993-
<li>Append a newline followed by two spaces to |s|.
994-
<li>Append |rule| to |s|.
995-
</ol>
996-
<li>Append a newline followed by RIGHT CURLY BRACKET (U+007D) to |s|.
997-
<li>Return |s|.
998-
</ol>
934+
(<a href="https://github.com/w3c/csswg-drafts/issues/7850">Issue 7850</a>)
935+
</div>

0 commit comments

Comments
 (0)