You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p> This section describes how to <dfndata-dfn-type=dfndata-export="" id=evaluate-a-selector>evaluate a selector<aclass=self-linkhref=#evaluate-a-selector></a></dfn> against a set of elements.
799
798
799
+
<p> APIs using this algorithm must provide a selector.
800
+
They may optionally provide:
801
+
802
+
<p><ul>
803
+
<li>
804
+
a <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a> of elements to match against.
805
+
If not specified, the <adata-link-type=dfnhref=#initial-selector-match-listtitle="initial selector match list">initial selector match list</a> for the selector’s context is used.
806
+
807
+
<li>
808
+
a <adata-link-type=dfnhref=#scoping-method-title="scoping method">scoping method</a> and <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a>.
809
+
If not specified, the selector defaults to being unscoped.
810
+
811
+
<li>
812
+
a set of <adata-link-type=dfnhref=#scope-elementtitle=":scope elements">:scope elements</a>,
813
+
for resolving the <aclass=cssdata-link-type=maybehref=#scope-pseudotitle=:scope>:scope</a> pseudo-class against.
814
+
If not specified,
815
+
the set defaults to being empty.
816
+
817
+
<p> If the selector is a <adata-link-type=dfnhref=#relative-selector-title="relative selector">relative selector</a>,
818
+
the set of <adata-link-type=dfnhref=#scope-elementtitle=":scope elements">:scope elements</a> must not be empty.
819
+
820
+
<pclass=note> Note: Note that if the selector is scoped,
821
+
the scoping root is automatically taken as the <adata-link-type=dfnhref=#scope-elementtitle=":scope element">:scope element</a>,
822
+
so it doesn’t have to be provided explicitly
823
+
unless a different result is desired.
824
+
825
+
<li>
826
+
which <adata-link-type=dfnhref=#pseudo-elementtitle=pseudo-elements>pseudo-elements</a> are allowed to show up in the match list, if any.
827
+
If not specified, this defaults to allowing all pseudo-elements.
828
+
</ul>
829
+
800
830
<p> A <adata-link-type=dfnhref=#selectortitle=selector>selector</a> is evaluated against some initial list of elements,
801
831
as determined by the context that the selector is evaluated in:
802
832
the <dfndata-dfn-type=dfndata-export="" id=selector-match-list>selector match list<aclass=self-linkhref=#selector-match-list></a></dfn>.
<p> The selector is processed from left to right in order,
809
839
with <adata-link-type=dfnhref=#simpletitle="simple selectors">simple selectors</a> filtering the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a>,
810
-
and <adata-link-type=dfnhref=#combinatortitle=combinators>combinators</a> changing the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a> into something new.
840
+
and <adata-link-type=dfnhref=#combinatortitle=combinators>combinators</a>and <adata-link-type=dfnhref=#pseudo-elementtitle=pseudo-elements>pseudo-elements</a>changing the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a> into something new.
811
841
If the selector is <adata-link-type=dfnhref=#scope-contained-title=scope-contained>scope-contained</a>
812
842
then after each <adata-link-type=dfnhref=#combinatortitle=combinator>combinator</a>
813
843
the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a> must be filtered
814
844
to contain only elements that are either the <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a>
815
845
or descendants of the <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a>.
816
-
If the selector is <adata-link-type=dfnhref=#scope-filtered-title=scope-filtered>scope-filtered</a>,
846
+
847
+
<p> If the selector is <adata-link-type=dfnhref=#scope-filtered-title=scope-filtered>scope-filtered</a>,
817
848
then after the selector is finished processing,
818
849
the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a> must be filtered
819
850
to contain only elements that are either the <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a>
820
851
or descendants of the <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a>.
821
852
853
+
<p> After the selector is finished matching,
854
+
the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a> must be filtered
855
+
to only contain elements and <adata-link-type=dfnhref=#pseudo-elementtitle=pseudo-elements>pseudo-elements</a>
856
+
allowed by the invoker of this algorithm.
857
+
822
858
<p> When this process is done, the elements in the <adata-link-type=dfnhref=#selector-match-listtitle="selector match list">selector match list</a>
Match A Selector</span><aclass=self-linkhref=#match-a-selector></a></h3>
3406
-
3407
-
<p> This section describes how to <dfndata-dfn-type=dfndata-export="" id=match-a-selector0>match a selector<aclass=self-linkhref=#match-a-selector0></a></dfn><var>selector</var>.
3408
-
Optionally, a tree of nodes <var>nodes</var> to be matched against may be provided;
3409
-
if not, the default <adata-link-type=dfnhref=#initial-selector-match-listtitle="initial selector match list">initial selector match list</a> for selectors in the given context is used as <var>nodes</var>.
3410
-
Optionally, a <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a> and <adata-link-type=dfnhref=#scoping-method-title="scoping method">scoping method</a> (<adata-link-type=dfnhref=#scope-contained-title=scope-contained>scope-contained</a> or <adata-link-type=dfnhref=#scope-filtered-title=scope-filtered>scope-filtered</a>) may be provided.
3411
-
Optionally, an explicit <adata-link-type=dfnhref=#scope-elementtitle=":scope elements">:scope elements</a><var>element set</var> (which may be empty) may be provided.
3412
-
It returns a list of zero or more elements.
3413
-
3414
-
<p><adata-link-type=dfnhref=#evaluate-a-selectortitle="evaluate a selector">Evaluate a selector</a><var>selector</var> against <var>nodes</var>
3415
-
with the <adata-link-type=dfnhref=#scoping-roottitle="scoping root">scoping root</a>,
0 commit comments