Skip to content

Commit a4ac0cc

Browse files
committed
[selectors] Now that scoped stylesheets are gone, we can kill scope-contained. DOM is the only consumer of scope-filtered, and they don't want the scoping element included, so fix that too.
1 parent fe6fb93 commit a4ac0cc

File tree

1 file changed

+17
-37
lines changed

1 file changed

+17
-37
lines changed

selectors/Overview.bs

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -633,35 +633,24 @@ Scoped Selectors</h3>
633633
and may be either a true element (the <dfn export>scoping element</dfn>)
634634
or a <dfn export lt="virtual scoping root">virtual</dfn> one (such as a <a interface>DocumentFragment</a>).
635635

636-
There are two <dfn export lt="scoping method | selector scoping method">scoping methods</dfn> for selectors:
637-
638-
<dl>
639-
<dt><dfn export id="scope-contained" lt="scope-contained | scope-contained selector">scope-contained</dfn>
640-
<dd>
641-
With this method of scoping, selectors match as if
642-
the <a>scoping root</a> were the root of the document:
643-
all <a>compound selectors</a> must be represented within the scope.
644-
(The '':root'' pseudo-class, however,
645-
still only matches the actual root of the document.)
646-
647-
<dt><dfn export id="scope-filtered" lt="scope-filtered | scope-filtered selector">scope-filtered</dfn>
648-
<dd>
649-
With this method of scoping, a selector matches an element only if the element is within the scope,
650-
even if other components of the selector are outside the scope.
651-
(A <a>scoping element</a> is considered to be in scope.)
652-
</dl>
636+
When a selector is <a>scoped</a>,
637+
it matches an element only if the element is a descendant of the <a>scoping root</a>.
638+
(The rest of the selector can match unrestricted;
639+
it's only the final matched elements that must be within the scope.)
653640

654641
<div class='example'>
655642
For example,
656643
the <code>element.querySelector()</code> function defined in [[DOM]]
657-
allows the author to define a <a>scope-filtered</a> selector.
644+
allows the author to evalute a <a>scoped</a> selector
645+
relative to the <code>element</code> it's called on.
658646

659-
On the other hand, the selectors within an [[HTML5]] scoped stylesheet
660-
define <a>scope-contained</a> selectors.
647+
A call like <code highlight=js>widget.querySelector("a")</code>
648+
will thus only find <{a}> elements inside of the <code>widget</code> element,
649+
ignoring any other <{a}>s that might be scattered throughout the document.
661650
</div>
662651

663-
Note: If there are no <a>:scope elements</a> when a selector is evaluated,
664-
the <a>scoping root</a> acts like a <a>:scope element</a>.
652+
Note: If the context does not explicitly define any <a>:scope elements</a> for the selector,
653+
the <a>scoping root</a> is a <a>:scope element</a>.
665654

666655
<h3 id="relative">
667656
Relative Selectors</h3>
@@ -677,7 +666,7 @@ Relative Selectors</h3>
677666
However, it must be <a href="#absolutize">absolutized</a> before matching.
678667

679668
Relative selectors, once absolutized,
680-
can additionally be <a>scope-contained</a> or <a>scope-filtered</a>.
669+
can additionally be <a>scoped</a>.
681670

682671
<h4 id='absolutizing'>
683672
Absolutizing a Relative Selector</h4>
@@ -3177,7 +3166,8 @@ Evaluating a Selector</h3>
31773166

31783167
<ul>
31793168
<li>
3180-
a <a>scoping method</a> and <a>scoping root</a>.
3169+
a <a>scoping root</a>,
3170+
indicating that the selector is <a>scoped</a>.
31813171
If not specified, the selector defaults to being unscoped.
31823172

31833173
<li>
@@ -3205,25 +3195,14 @@ Evaluating a Selector</h3>
32053195
provided to the algorithm,
32063196
and all their <a>descendants</a>.
32073197

3208-
If the selector is <a>scope-contained</a>,
3209-
the <a>selector match list</a> is immediately filtered
3210-
to contain only elements that are either the <a>scoping root</a>
3211-
or <a>descendants</a> of the <a>scoping root</a>.
3212-
32133198
The selector is processed from left to right in order,
32143199
with <a>simple selectors</a> filtering the <a>selector match list</a>,
32153200
and <a>combinators</a> and <a>pseudo-elements</a> changing the <a>selector match list</a> into something new.
3216-
If the selector is <a>scope-contained</a>
3217-
then after each <a>combinator</a>
3218-
the <a>selector match list</a> must be filtered
3219-
to contain only elements that are either the <a>scoping root</a>
3220-
or <a>descendants</a> of the <a>scoping root</a>.
32213201

32223202
If the selector is <a>scope-filtered</a>,
32233203
then after the selector is finished processing,
32243204
the <a>selector match list</a> must be filtered
3225-
to contain only elements that are either the <a>scoping root</a>
3226-
or <a>descendants</a> of the <a>scoping root</a>.
3205+
to contain only elements that are <a>descendants</a> of the <a>scoping root</a>.
32273206

32283207
After the selector is finished matching,
32293208
the <a>selector match list</a> must be filtered
@@ -3326,7 +3305,8 @@ Match a Selector Against A Tree</h3>
33263305

33273306
<ul>
33283307
<li>
3329-
A <a>scoping method</a> and <a>scoping root</a>.
3308+
A <a>scoping root</a>
3309+
indicating the selector is <a>scoped</a>.
33303310
If not specified,
33313311
the <var>selector</var> defaults to being unscoped.
33323312

0 commit comments

Comments
 (0)