Skip to content

Commit be44320

Browse files
committed
[css-scoping][selectors] Make featureless elements match *nothing*. Make Scoping clearer about what is allowed to match the host element.
1 parent 51807b8 commit be44320

2 files changed

Lines changed: 6 additions & 33 deletions

File tree

css-scoping/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Host Elements in a Shadow Tree</h4>
277277

278278
When considered within its own <a>shadow trees</a>,
279279
the <a>host element</a> is <a>featureless</a>.
280-
(That is, <a>feature selectors</a> like class, tagname, or even ''*'' never match it.)
280+
Only the '':host'', '':host()'', and '':host-context()'' pseudo-classes are allowed to match it.
281281

282282
<details class='why'>
283283
<summary>Why is the shadow host so weird?</summary>

selectors/Overview.bs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -668,45 +668,18 @@ Data Model</h3>
668668
<li>Attributes, which are pairs of strings consisting of an attribute name and an attribute value.
669669
</ul>
670670

671-
These aspects are referred to as <dfn export lt="feature">features</dfn>.
672-
The <a>simple selectors</a> which are keyed off of them
673-
(<a>universal selector</a>, <a>type selectors</a>, <a>ID selectors</a>, <a>class selectors</a>, and <a>attribute selectors</a>)
674-
are called <dfn export lt="feature selector">feature selectors</dfn>.
675-
676-
While elements may lack any of the individual <a>features</a>,
671+
While individual elements may lack any of the above features,
677672
some elements are <dfn export>featureless</dfn>.
678-
A <a>featureless</a> element does not match any <a>feature selector</a>,
679-
or any selector that resolves based on <a>features</a>
680-
(such as '':not(div)''),
681-
with the exception of namespace selectors--
682-
a <a>featureless</a> element is treated as having <em>all</em> namespaces.
683-
Thus, only <a>pseudo-classes</a> or <a>pseudo-elements</a> can be used to select them.
684-
Individual <a>featureless</a> elements may define additional restrictions on what kinds of selectors can match them.
673+
A <a>featureless</a> element does not match any selector at all,
674+
except those it is explicitly defined to match.
675+
If a given selector <em>is</em> allowed to match a <a>featureless</a> element,
676+
it must do so while ignoring the default namespace. [[CSS3NAMESPACE]]
685677

686678
<div class='example'>
687679
For example, the <a>host element</a> in a <a>shadow tree</a> is <a>featureless</a>,
688680
and can't be matched by <em>any</em> <a>pseudo-class</a> except for '':host'' and '':host-context()''.)
689681
</div>
690682

691-
<details class='why'>
692-
<summary>Why do featureless elements match all namespaces?</summary>
693-
694-
In a previous version of Selectors,
695-
all <a>compound selectors</a> contained a <a>type selector</a>;
696-
if you didn't supply one explicitly,
697-
a <a>universal selector</a> was implied.
698-
Default namespaces [[CSS3NAMESPACE]] affected the implied universal selector,
699-
so that selectors like '':hover'' actually meant ''defaultNS|*:hover''.
700-
701-
The universal selector is no longer implied,
702-
but default namespaces still exist,
703-
and have to apply to all compound selectors.
704-
The behavior of <a>featureless</a> elements,
705-
like the <a>host element</a> in a shadow tree,
706-
thus needs to accommodate that and work appropriately.
707-
In this case, "appropriately" means "ignoring the default namespace".
708-
</details>
709-
710683
When matching a selector against a document which is in <a>quirks mode</a>,
711684
class and ID selectors must be matched <a lt="ASCII case-insensitive">ASCII case-insensitively</a>
712685
against the classes and ID of the elements in the document.

0 commit comments

Comments
 (0)