Skip to content

Commit 8b02d45

Browse files
committed
[selectors-nonelement] Break up the grammar a bit more, for readability.
--HG-- extra : rebase_source : 1dae61e27d756c7e303302f9f66eab255ddb1b69
1 parent 769c56f commit 8b02d45

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

selectors-nonelement/Overview.bs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Attribute node selector</h3>
4141

4242
<pre class='prod'>
4343
<dfn selector>::attr()</dfn> = ::attr( <<namespace-attr>>? )
44-
<dfn>&lt;namespace-attr></dfn> = [ [ <<ident>> | '*' ]? '|' ]? [ <<ident>> | '*' ]
44+
<dfn>&lt;namespace-attr></dfn> = [ <<na-prefix>>? '|' ]? <<na-name>>
45+
<dfn>&lt;na-prefix></dfn> = <<ident>> | '*'
46+
<dfn>&lt;na-name></dfn> = <<ident>> | '*'
4547
</pre>
4648

4749
No whitespace is allowed between the tokens of <<namespace-attr>>.
@@ -50,19 +52,19 @@ Attribute node selector</h3>
5052
an optional prefix preceding a '|' character,
5153
and an attribute name following it.
5254

53-
If the prefix is provided as an <<ident>>,
55+
If the <<na-prefix>> is provided as an <<ident>>,
5456
it must match a declared <a>namespace prefix</a>,
5557
in which case the selector only matches attributes in that namespace;
5658
if it doesn't match a declared <a>namespace prefix</a>,
5759
the selector is invalid.
58-
If the prefix is provided as a '*' character,
60+
If the <<na-prefix>> is provided as a '*' character,
5961
the selector matches attributes in any namespace.
60-
If the prefix is omitted,
62+
If the <<na-prefix>> is omitted,
6163
the selector only matches attributes in no namespace.
6264

63-
If the attribute name is an <<ident>>,
65+
If the <<na-name>> is an <<ident>>,
6466
the selector matches attributes with that name.
65-
If the attribute name is a '*' character,
67+
If the <<na-name>> is a '*' character,
6668
the selector matches any attribute.
6769

6870
If the <<namespace-attr>> is omitted entirely,

selectors-nonelement/Overview.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,29 @@ <h3 class="heading settled heading" data-level=2.1 id=attribute-node-selector><s
154154
Its syntax is:
155155

156156
<pre class=prod> <dfn class=css-code data-dfn-type=selector data-export="" id=selectordef-attr>::attr()<a class=self-link href=#selectordef-attr></a></dfn> = ::attr( <a class="production css-code" data-link-type=type href=#typedef-namespace-attr title="<namespace-attr>">&lt;namespace-attr&gt;</a>? )
157-
<dfn class=css-code data-dfn-type=type data-export="" id=typedef-namespace-attr>&lt;namespace-attr&gt;<a class=self-link href=#typedef-namespace-attr></a></dfn> = [ [ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a> | '*' ]? '|' ]? [ <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a> | '*' ]
157+
<dfn class=css-code data-dfn-type=type data-export="" id=typedef-namespace-attr>&lt;namespace-attr&gt;<a class=self-link href=#typedef-namespace-attr></a></dfn> = [ <a class="production css-code" data-link-type=type href=#typedef-na-prefix title="<na-prefix>">&lt;na-prefix&gt;</a>? '|' ]? <a class="production css-code" data-link-type=type href=#typedef-na-name title="<na-name>">&lt;na-name&gt;</a>
158+
<dfn class=css-code data-dfn-type=type data-export="" id=typedef-na-prefix>&lt;na-prefix&gt;<a class=self-link href=#typedef-na-prefix></a></dfn> = <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a> | '*'
159+
<dfn class=css-code data-dfn-type=type data-export="" id=typedef-na-name>&lt;na-name&gt;<a class=self-link href=#typedef-na-name></a></dfn> = <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a> | '*'
158160
</pre>
159161
<p> No whitespace is allowed between the tokens of <a class="production css-code" data-link-type=type href=#typedef-namespace-attr title="<namespace-attr>">&lt;namespace-attr&gt;</a>.
160162

161163
<p> <a class="production css-code" data-link-type=type href=#typedef-namespace-attr title="<namespace-attr>">&lt;namespace-attr&gt;</a> is divided into two halves:
162164
an optional prefix preceding a '|' character,
163165
and an attribute name following it.
164166

165-
<p> If the prefix is provided as an <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a>,
167+
<p> If the <a class="production css-code" data-link-type=type href=#typedef-na-prefix title="<na-prefix>">&lt;na-prefix&gt;</a> is provided as an <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a>,
166168
it must match a declared <a data-link-type=dfn href=http://dev.w3.org/csswg/css-namespaces-1/#namespace-prefix title="namespace prefix">namespace prefix</a>,
167169
in which case the selector only matches attributes in that namespace;
168170
if it doesn’t match a declared <a data-link-type=dfn href=http://dev.w3.org/csswg/css-namespaces-1/#namespace-prefix title="namespace prefix">namespace prefix</a>,
169171
the selector is invalid.
170-
If the prefix is provided as a <a class=property data-link-type=propdesc title=*>*</a> character,
172+
If the <a class="production css-code" data-link-type=type href=#typedef-na-prefix title="<na-prefix>">&lt;na-prefix&gt;</a> is provided as a <a class=property data-link-type=propdesc title=*>*</a> character,
171173
the selector matches attributes in any namespace.
172-
If the prefix is omitted,
174+
If the <a class="production css-code" data-link-type=type href=#typedef-na-prefix title="<na-prefix>">&lt;na-prefix&gt;</a> is omitted,
173175
the selector only matches attributes in no namespace.
174176

175-
<p> If the attribute name is an <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a>,
177+
<p> If the <a class="production css-code" data-link-type=type href=#typedef-na-name title="<na-name>">&lt;na-name&gt;</a> is an <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#ltident title="<ident>">&lt;ident&gt;</a>,
176178
the selector matches attributes with that name.
177-
If the attribute name is a <a class=property data-link-type=propdesc title=*>*</a> character,
179+
If the <a class="production css-code" data-link-type=type href=#typedef-na-name title="<na-name>">&lt;na-name&gt;</a> is a <a class=property data-link-type=propdesc title=*>*</a> character,
178180
the selector matches any attribute.
179181

180182
<p> If the <a class="production css-code" data-link-type=type href=#typedef-namespace-attr title="<namespace-attr>">&lt;namespace-attr&gt;</a> is omitted entirely,
@@ -336,6 +338,8 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content>
336338
<li>::attr(), <a href=#selectordef-attr title="section 2.1">2.1</a>
337339
<li>attribute node selector, <a href=#attribute-node-selector0 title="section 2.1">2.1</a>
338340
<li>&lt;namespace-attr&gt;, <a href=#typedef-namespace-attr title="section 2.1">2.1</a>
341+
<li>&lt;na-name&gt;, <a href=#typedef-na-name title="section 2.1">2.1</a>
342+
<li>&lt;na-prefix&gt;, <a href=#typedef-na-prefix title="section 2.1">2.1</a>
339343
</ul></div>
340344

341345
<h2 class="no-num no-ref heading settled heading" id=property-index><span class=content>

0 commit comments

Comments
 (0)