[selectors] Rebase the data model onto DOM explicitly.

Tue, 22 Apr 2014 16:18:54 -0700

author
Tab Atkins Jr. <jackalmage@gmail.com>
date
Tue, 22 Apr 2014 16:18:54 -0700
changeset 13786
625b67ab1d46
parent 13785
a423f0deea6d
child 13787
a310692c2ad8

[selectors] Rebase the data model onto DOM explicitly.

selectors/Overview.bs file | annotate | diff | comparison | revisions
selectors/Overview.html file | annotate | diff | comparison | revisions
     1.1 --- a/selectors/Overview.bs	Mon Apr 21 18:53:08 2014 -0700
     1.2 +++ b/selectors/Overview.bs	Tue Apr 22 16:18:54 2014 -0700
     1.3 @@ -20,7 +20,7 @@
     1.4  Abstract: Selectors Level 4 describes the selectors that already exist in [[!SELECT]], and further introduces new selectors for CSS and other languages that may need them.
     1.5  At Risk: the column combinator
     1.6  At Risk: The '':drop()'' pseudo-class
     1.7 -Ignored Terms: DocumentFragment, math, h1, shadow tree, box tree, query()
     1.8 +Ignored Terms: DocumentFragment, math, h1, shadow tree, box tree, query(), element tree
     1.9  Link Defaults: html5 (element) a
    1.10  </pre>
    1.11  <style>
    1.12 @@ -666,24 +666,36 @@
    1.13  <h3 id='data-model'>
    1.14  Data Model</h3>
    1.15  
    1.16 -	Selectors are matched against an <dfn export>element tree</dfn>,
    1.17 -	which is an abstract tree structure containing elements
    1.18 -	having the structure defined in the <a href="http://dom.spec.whatwg.org/#trees">DOM Standard</a> [[!DOM]].
    1.19 -
    1.20 -	Each element may have any of:
    1.21 +	Selectors are evaluated against a DOM tree. [[!DOM]]
    1.22 +	Within this specification,
    1.23 +	this may be referred to as the "document tree".
    1.24 +
    1.25 +	In addition to the information present in the document tree,
    1.26 +	for the purpose of selectors,
    1.27 +	elements are assumed to have arbitrary <a>pseudo-class</a> flags
    1.28 +	and <a>pseudo-element</a> slots,
    1.29 +	as defined by the given <a>pseudo-class</a> and <a>pseudo-element</a>.
    1.30 +
    1.31 +	<div class='example'>
    1.32 +		For example, the first element child of each element
    1.33 +		has a flag indicating that it matches the '':first-child'' pseudo-element.
    1.34 +
    1.35 +		For another example,
    1.36 +		all elements have ''::before'' pseudo-elements,
    1.37 +		but not only elements with <a>shadow trees</a> have ''::shadow'' pseudo-elements.
    1.38 +	</div>
    1.39 +
    1.40 +	Four aspects of a DOM element are especially relevant for selectors:
    1.41  
    1.42  	<ul>
    1.43 -		<li>A type, which is a pair of strings: a namespace and a local name.
    1.44 +		<li>The element's type (also known as tagname),
    1.45 +			which is a pair of strings: a namespace and a local name.
    1.46  		<li>An ID, which is a string.
    1.47  		<li>Classes, which are strings.
    1.48  		<li>Attributes, which are pairs of strings consisting of an attribute name and an attribute value.
    1.49 -		<li>A list of child elements.
    1.50 -		<li>Arbitrary additional information,
    1.51 -			which isn't directly accessible,
    1.52 -			but can be used in the matching of pseudo-classes and pseudo-elements.
    1.53  	</ul>
    1.54  
    1.55 -	The first four bullet points in the list above are referred to as <dfn export title="feature">features</dfn>.
    1.56 +	These aspects are referred to as <dfn export title="feature">features</dfn>.
    1.57  	The <a>simple selectors</a> which are keyed off of them
    1.58  	(<a>universal selector</a>, <a>type selectors</a>, <a>ID selectors</a>, <a>class selectors</a>, and <a>attribute selectors</a>)
    1.59  	are called <dfn export title="feature selector">feature selectors</dfn>.
    1.60 @@ -697,17 +709,113 @@
    1.61  	also never match them.
    1.62  	Thus, only <a>pseudo-classes</a> or <a>pseudo-elements</a> can be used to select them.
    1.63  	Individual <a>featureless</a> elements may define additional restrictions on what kinds of selectors can match them.
    1.64 -	(For example, the <a>host element</a> in a <a>shadow tree</a> is <a>featureless</a>,
    1.65 -	and can't be matched by <em>any</em> <a>pseudo-class</a> except for '':host'' and '':host-context()''.)
    1.66 -
    1.67 -	In a DOM document,
    1.68 -	the DOM is used as the <a>element tree</a>.
    1.69 -	Each DOM element is an element in the <a>element tree</a>,
    1.70 -	with the DOM element's namespace and local name as the type,
    1.71 -	and its ID, class list, attributes, and child elements
    1.72 -	as the ID, classes, attributes, and child elements in the <a>element tree</a>.
    1.73 -	The rest of the information in the DOM is also accessible
    1.74 -	as the arbitrary additional information in the <a>element tree</a>.
    1.75 +
    1.76 +	<div class='example'>
    1.77 +		For example, the <a>host element</a> in a <a>shadow tree</a> is <a>featureless</a>,
    1.78 +		and can't be matched by <em>any</em> <a>pseudo-class</a> except for '':host'' and '':host-context()''.)
    1.79 +	</div>
    1.80 +
    1.81 +<h4 id='dom-mapping'>
    1.82 +Guidance on Mapping Document Languages to DOM</h4>
    1.83 +
    1.84 +	The DOM document structure is powerful and useful,
    1.85 +	but generic enough to model pretty much any langauge that describes tree-based data
    1.86 +	(or even graph-based, with a suitable interpretation).
    1.87 +
    1.88 +	Some languages, like HTML, already have well-defined procedures
    1.89 +	for producing a DOM object from a resource.
    1.90 +	If a given language does not,
    1.91 +	such a procedure must be defined
    1.92 +	in order for Selectors to apply to documents in that language.
    1.93 +
    1.94 +	At minimum,
    1.95 +	the document language must define what maps to the DOM concept of an "element".
    1.96 +
    1.97 +	The primary one-to-many relationship between nodes--
    1.98 +	parent/child in tree-based structures,
    1.99 +	element/neighbors in graph-based structures--
   1.100 +	should be reflected as the child nodes of an element.
   1.101 +
   1.102 +	Other features of the element should be reflected as <a>features</a> when possible,
   1.103 +	mapping to something that serves a similar purpose to the same feature in DOM:
   1.104 +
   1.105 +	<dl>
   1.106 +		<dt>type
   1.107 +		<dd>
   1.108 +			If the elements in the document language have some notion of "type"
   1.109 +			as a basic distinguisher between different groups of elements,
   1.110 +			it should be reflected as the "type" <a>feature</a>.
   1.111 +
   1.112 +			If this "type" can be separated into a "basic" name
   1.113 +			and a "namespace" that groups names into higher-level groups,
   1.114 +			that should be reflected in the "namespace" and "local name" divisions of the "type" <a>feature</a>.
   1.115 +			Otherwise, the "namespace" part should be the empty string,
   1.116 +			and the entire name should be in the "local name" part.
   1.117 +
   1.118 +		<dt>id
   1.119 +		<dd>
   1.120 +			If some aspect of the element functions as a unique identifier across the document,
   1.121 +			it should be mapped to the "id" <a>feature</a>.
   1.122 +
   1.123 +			Note: While HTML only allows an element to have a single ID,
   1.124 +			this should not be taken as a general restriction.
   1.125 +			The important quality of an ID is that each ID should be associated with a single element;
   1.126 +			a single element can validly have multiple IDs.
   1.127 +
   1.128 +		<dt>classes and attributes
   1.129 +		<dd>
   1.130 +			Aspects of the element that are useful for identifying the element,
   1.131 +			but are not generally unique to elements within a document,
   1.132 +			should be mapped to the "class" or "attribute" <a>features</a>
   1.133 +			depending on if they're something equivalent to a "label" (a string by itself)
   1.134 +			or a "property" (a name/value pair)
   1.135 +
   1.136 +		<dt>pseudo-classes and pseudo-attributes
   1.137 +		<dd>
   1.138 +			If any elements match any pseudo-classes or have any pseudo-elements,
   1.139 +			that must be explicitly defined.
   1.140 +
   1.141 +			Issue: Some pseudo-classes are *syntactical*,
   1.142 +			like '':has()'' and '':matches()'',
   1.143 +			and thus should always work.
   1.144 +			Need to indicate that somewhere.
   1.145 +			Probably the structural pseudos always work
   1.146 +			whenever the child list is ordered.
   1.147 +	</dl>
   1.148 +
   1.149 +	<div class='example'>
   1.150 +		For example, <a href>JSONSelect</a> is a library that uses selectors
   1.151 +		to extract information from JSON documents.
   1.152 +
   1.153 +		<ul>
   1.154 +			<li>
   1.155 +				The "elements" of the JSON document
   1.156 +				are each array, object, boolean, string, number, or null.
   1.157 +				The array and object elements have their contents as children.
   1.158 +
   1.159 +			<li>
   1.160 +				Each element's type is its JS type name:
   1.161 +				"array", "object", etc.
   1.162 +
   1.163 +			<li>
   1.164 +				Children of an object
   1.165 +				have their key as a class.
   1.166 +
   1.167 +			<li>
   1.168 +				Children of an array match the '':first-child'', '':nth-child()'', etc pseudo-classes.
   1.169 +
   1.170 +			<li>
   1.171 +				The root object matches '':root''.
   1.172 +
   1.173 +			<li>
   1.174 +				It additionally defines '':val()'' and '':contains()'' pseudo-classes,
   1.175 +				for matching boolean/number/string elements with a particular value
   1.176 +				or which contain a particular substring.
   1.177 +		</ul>
   1.178 +
   1.179 +		This structure is sufficient to allow powerful, compact querying of JSON documents with selectors.
   1.180 +	</div>
   1.181 +
   1.182  
   1.183  
   1.184  <h3 id="scoping">
     2.1 --- a/selectors/Overview.html	Mon Apr 21 18:53:08 2014 -0700
     2.2 +++ b/selectors/Overview.html	Tue Apr 22 16:18:54 2014 -0700
     2.3 @@ -59,7 +59,7 @@
     2.4  </p>
     2.5    <h1 class="p-name no-ref" id=title>Selectors Level 4</h1>
     2.6    <h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
     2.7 -    <span class=dt-updated><span class=value-title title=20140418>18 April 2014</span></span></span></h2>
     2.8 +    <span class=dt-updated><span class=value-title title=20140422>22 April 2014</span></span></span></h2>
     2.9    <div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/selectors>http://dev.w3.org/csswg/selectors</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/selectors/>http://www.w3.org/TR/selectors/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/selectors>http://dev.w3.org/csswg/selectors</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2013/WD-selectors4-20130502/ rel=previous>http://www.w3.org/TR/2013/WD-selectors4-20130502/</a><dd><a href=http://www.w3.org/TR/2012/WD-selectors4-20120823/ rel=previous>http://www.w3.org/TR/2012/WD-selectors4-20120823/</a><dd><a href=http://www.w3.org/TR/2011/WD-selectors4-20110929/ rel=previous>http://www.w3.org/TR/2011/WD-selectors4-20110929/</a>
    2.10      <dt>Feedback:</dt>
    2.11          <dd><a href="mailto:www-style@w3.org?subject=%5Bselectors%5D%20feedback">www-style@w3.org</a>
    2.12 @@ -124,6 +124,8 @@
    2.13  		<li><a href=#structure><span class=secno>3.1</span> Structure and Terminology</a>
    2.14  		<li><a href=#evaluating-selectors><span class=secno>3.2</span> Evaluating a Selector</a>
    2.15  		<li><a href=#data-model><span class=secno>3.3</span> Data Model</a>
    2.16 +			<ul class=toc>
    2.17 +			<li><a href=#dom-mapping><span class=secno>3.3.1</span> Guidance on Mapping Document Languages to DOM</a></ul>
    2.18  		<li><a href=#scoping><span class=secno>3.4</span> Scoped Selectors</a>
    2.19  		<li><a href=#relative><span class=secno>3.5</span> Relative Selectors</a>
    2.20  			<ul class=toc>
    2.21 @@ -801,7 +803,7 @@
    2.22  <p>	This section describes how to <dfn data-dfn-type=dfn data-export="" id=evaluate-a-selector>evaluate a selector<a class=self-link href=#evaluate-a-selector></a></dfn> against a set of elements.
    2.23  
    2.24  <p>	APIs using this algorithm must provide a selector,
    2.25 -	and one or more <a data-link-type=dfn href=#element-tree title="element tree">element tree</a> root elements
    2.26 +	and one or more <a data-link-type=dfn title="element tree">element tree</a> root elements
    2.27  	indicating the trees that will be searched by the selector.
    2.28  	They may optionally provide:
    2.29  
    2.30 @@ -831,7 +833,7 @@
    2.31  
    2.32  <p>	A <a data-link-type=dfn href=#selector title=selector>selector</a> is evaluated against some initial list of elements:
    2.33  	the <dfn data-dfn-type=dfn data-export="" id=selector-match-list>selector match list<a class=self-link href=#selector-match-list></a></dfn>.
    2.34 -	The <a data-link-type=dfn href=#selector-match-list title="selector match list">selector match list</a> is initially populated with the <a data-link-type=dfn href=#element-tree title="element tree">element tree</a> roots
    2.35 +	The <a data-link-type=dfn href=#selector-match-list title="selector match list">selector match list</a> is initially populated with the <a data-link-type=dfn title="element tree">element tree</a> roots
    2.36  	provided to the algorithm,
    2.37  	and all elements reachable from them by traversing any number of child lists.
    2.38  
    2.39 @@ -894,24 +896,36 @@
    2.40  <h3 class="heading settled heading" data-level=3.3 id=data-model><span class=secno>3.3 </span><span class=content>
    2.41  Data Model</span><a class=self-link href=#data-model></a></h3>
    2.42  
    2.43 -<p>	Selectors are matched against an <dfn data-dfn-type=dfn data-export="" id=element-tree>element tree<a class=self-link href=#element-tree></a></dfn>,
    2.44 -	which is an abstract tree structure containing elements
    2.45 -	having the structure defined in the <a href=http://dom.spec.whatwg.org/#trees>DOM Standard</a> <a data-biblio-type=normative data-link-type=biblio href=#dom title=dom>[DOM]</a>.
    2.46 -
    2.47 -<p>	Each element may have any of:
    2.48 +<p>	Selectors are evaluated against a DOM tree. <a data-biblio-type=normative data-link-type=biblio href=#dom title=dom>[DOM]</a>
    2.49 +	Within this specification,
    2.50 +	this may be referred to as the "document tree".
    2.51 +
    2.52 +<p>	In addition to the information present in the document tree,
    2.53 +	for the purpose of selectors,
    2.54 +	elements are assumed to have arbitrary <a data-link-type=dfn href=#pseudo-class title=pseudo-class>pseudo-class</a> flags
    2.55 +	and <a data-link-type=dfn href=#pseudo-element title=pseudo-element>pseudo-element</a> slots,
    2.56 +	as defined by the given <a data-link-type=dfn href=#pseudo-class title=pseudo-class>pseudo-class</a> and <a data-link-type=dfn href=#pseudo-element title=pseudo-element>pseudo-element</a>.
    2.57 +
    2.58 +	<div class=example>
    2.59 +		For example, the first element child of each element
    2.60 +		has a flag indicating that it matches the <a class=css data-link-type=maybe href=#first-child-pseudo title=:first-child>:first-child</a> pseudo-element.
    2.61 +
    2.62 +<p>		For another example,
    2.63 +		all elements have <span class=css data-link-type=maybe title=::before>::before</span> pseudo-elements,
    2.64 +		but not only elements with <a data-link-type=dfn href=http://dev.w3.org/csswg/css-scoping-1/#shadow-tree title="shadow trees">shadow trees</a> have <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-scoping-1/#selectordef-shadow title=::shadow>::shadow</a> pseudo-elements.
    2.65 +	</div>
    2.66 +
    2.67 +<p>	Four aspects of a DOM element are especially relevant for selectors:
    2.68  
    2.69  <p>	<ul>
    2.70 -		<li>A type, which is a pair of strings: a namespace and a local name.
    2.71 +		<li>The element’s type (also known as tagname),
    2.72 +			which is a pair of strings: a namespace and a local name.
    2.73  		<li>An ID, which is a string.
    2.74  		<li>Classes, which are strings.
    2.75  		<li>Attributes, which are pairs of strings consisting of an attribute name and an attribute value.
    2.76 -		<li>A list of child elements.
    2.77 -		<li>Arbitrary additional information,
    2.78 -			which isn’t directly accessible,
    2.79 -			but can be used in the matching of pseudo-classes and pseudo-elements.
    2.80  	</ul>
    2.81  
    2.82 -<p>	The first four bullet points in the list above are referred to as <dfn data-dfn-type=dfn data-export="" id=feature title=feature>features<a class=self-link href=#feature></a></dfn>.
    2.83 +<p>	These aspects are referred to as <dfn data-dfn-type=dfn data-export="" id=feature title=feature>features<a class=self-link href=#feature></a></dfn>.
    2.84  	The <a data-link-type=dfn href=#simple title="simple selectors">simple selectors</a> which are keyed off of them
    2.85  	(<a data-link-type=dfn href=#universal-selector0 title="universal selector">universal selector</a>, <a data-link-type=dfn href=#type-selector title="type selectors">type selectors</a>, <a data-link-type=dfn href=#id-selector title="id selectors">ID selectors</a>, <a data-link-type=dfn href=#class-selector title="class selectors">class selectors</a>, and <a data-link-type=dfn href=#attribute-selector title="attribute selectors">attribute selectors</a>)
    2.86  	are called <dfn data-dfn-type=dfn data-export="" id=feature-selector title="feature selector">feature selectors<a class=self-link href=#feature-selector></a></dfn>.
    2.87 @@ -925,17 +939,111 @@
    2.88  	also never match them.
    2.89  	Thus, only <a data-link-type=dfn href=#pseudo-class title=pseudo-classes>pseudo-classes</a> or <a data-link-type=dfn href=#pseudo-element title=pseudo-elements>pseudo-elements</a> can be used to select them.
    2.90  	Individual <a data-link-type=dfn href=#featureless title=featureless>featureless</a> elements may define additional restrictions on what kinds of selectors can match them.
    2.91 -	(For example, the <a data-link-type=dfn href=http://dev.w3.org/csswg/css-scoping-1/#host-element0 title="host element">host element</a> in a <a data-link-type=dfn href=http://dev.w3.org/csswg/css-scoping-1/#shadow-tree title="shadow tree">shadow tree</a> is <a data-link-type=dfn href=#featureless title=featureless>featureless</a>,
    2.92 -	and can’t be matched by <em>any</em> <a data-link-type=dfn href=#pseudo-class title=pseudo-class>pseudo-class</a> except for <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-scoping-1/#selectordef-host0 title=:host>:host</a> and <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-scoping-1/#selectordef-host-context title=:host-context()>:host-context()</a>.)
    2.93 -
    2.94 -<p>	In a DOM document,
    2.95 -	the DOM is used as the <a data-link-type=dfn href=#element-tree title="element tree">element tree</a>.
    2.96 -	Each DOM element is an element in the <a data-link-type=dfn href=#element-tree title="element tree">element tree</a>,
    2.97 -	with the DOM element’s namespace and local name as the type,
    2.98 -	and its ID, class list, attributes, and child elements
    2.99 -	as the ID, classes, attributes, and child elements in the <a data-link-type=dfn href=#element-tree title="element tree">element tree</a>.
   2.100 -	The rest of the information in the DOM is also accessible
   2.101 -	as the arbitrary additional information in the <a data-link-type=dfn href=#element-tree title="element tree">element tree</a>.
   2.102 +
   2.103 +	<div class=example>
   2.104 +		For example, the <a data-link-type=dfn href=http://dev.w3.org/csswg/css-scoping-1/#host-element0 title="host element">host element</a> in a <a data-link-type=dfn href=http://dev.w3.org/csswg/css-scoping-1/#shadow-tree title="shadow tree">shadow tree</a> is <a data-link-type=dfn href=#featureless title=featureless>featureless</a>,
   2.105 +		and can’t be matched by <em>any</em> <a data-link-type=dfn href=#pseudo-class title=pseudo-class>pseudo-class</a> except for <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-scoping-1/#selectordef-host0 title=:host>:host</a> and <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-scoping-1/#selectordef-host-context title=:host-context()>:host-context()</a>.)
   2.106 +	</div>
   2.107 +
   2.108 +<h4 class="heading settled heading" data-level=3.3.1 id=dom-mapping><span class=secno>3.3.1 </span><span class=content>
   2.109 +Guidance on Mapping Document Languages to DOM</span><a class=self-link href=#dom-mapping></a></h4>
   2.110 +
   2.111 +<p>	The DOM document structure is powerful and useful,
   2.112 +	but generic enough to model pretty much any langauge that describes tree-based data
   2.113 +	(or even graph-based, with a suitable interpretation).
   2.114 +
   2.115 +<p>	Some languages, like HTML, already have well-defined procedures
   2.116 +	for producing a DOM object from a resource.
   2.117 +	If a given language does not,
   2.118 +	such a procedure must be defined
   2.119 +	in order for Selectors to apply to documents in that language.
   2.120 +
   2.121 +<p>	At minimum,
   2.122 +	the document language must define what maps to the DOM concept of an "element".
   2.123 +
   2.124 +<p>	The primary one-to-many relationship between nodes—<wbr>parent/child in tree-based structures,
   2.125 +	element/neighbors in graph-based structures—<wbr>should be reflected as the child nodes of an element.
   2.126 +
   2.127 +<p>	Other features of the element should be reflected as <a data-link-type=dfn href=#feature title=features>features</a> when possible,
   2.128 +	mapping to something that serves a similar purpose to the same feature in DOM:
   2.129 +
   2.130 +	<dl>
   2.131 +		<dt>type
   2.132 +		<dd>
   2.133 +			If the elements in the document language have some notion of "type"
   2.134 +			as a basic distinguisher between different groups of elements,
   2.135 +			it should be reflected as the "type" <a data-link-type=dfn href=#feature title=feature>feature</a>.
   2.136 +
   2.137 +<p>			If this "type" can be separated into a "basic" name
   2.138 +			and a "namespace" that groups names into higher-level groups,
   2.139 +			that should be reflected in the "namespace" and "local name" divisions of the "type" <a data-link-type=dfn href=#feature title=feature>feature</a>.
   2.140 +			Otherwise, the "namespace" part should be the empty string,
   2.141 +			and the entire name should be in the "local name" part.
   2.142 +
   2.143 +		<dt>id
   2.144 +		<dd>
   2.145 +			If some aspect of the element functions as a unique identifier across the document,
   2.146 +			it should be mapped to the "id" <a data-link-type=dfn href=#feature title=feature>feature</a>.
   2.147 +
   2.148 +<p class=note>			Note: While HTML only allows an element to have a single ID,
   2.149 +			this should not be taken as a general restriction.
   2.150 +			The important quality of an ID is that each ID should be associated with a single element;
   2.151 +			a single element can validly have multiple IDs.
   2.152 +
   2.153 +		<dt>classes and attributes
   2.154 +		<dd>
   2.155 +			Aspects of the element that are useful for identifying the element,
   2.156 +			but are not generally unique to elements within a document,
   2.157 +			should be mapped to the "class" or "attribute" <a data-link-type=dfn href=#feature title=features>features</a>
   2.158 +			depending on if they’re something equivalent to a "label" (a string by itself)
   2.159 +			or a "property" (a name/value pair)
   2.160 +
   2.161 +		<dt>pseudo-classes and pseudo-attributes
   2.162 +		<dd>
   2.163 +			If any elements match any pseudo-classes or have any pseudo-elements,
   2.164 +			that must be explicitly defined.
   2.165 +
   2.166 +<p class=issue id=issue-66b7c28d><a class=self-link href=#issue-66b7c28d></a>			 Some pseudo-classes are *syntactical*,
   2.167 +			like <span class=css data-link-type=maybe title=:has()>:has()</span> and <a class=css data-link-type=maybe href=#matches-pseudo title=:matches()>:matches()</a>,
   2.168 +			and thus should always work.
   2.169 +			Need to indicate that somewhere.
   2.170 +			Probably the structural pseudos always work
   2.171 +			whenever the child list is ordered.
   2.172 +	</dl>
   2.173 +
   2.174 +	<div class=example>
   2.175 +		For example, <a href="">JSONSelect</a> is a library that uses selectors
   2.176 +		to extract information from JSON documents.
   2.177 +
   2.178 +<p>		<ul>
   2.179 +			<li>
   2.180 +				The "elements" of the JSON document
   2.181 +				are each array, object, boolean, string, number, or null.
   2.182 +				The array and object elements have their contents as children.
   2.183 +
   2.184 +			<li>
   2.185 +				Each element’s type is its JS type name:
   2.186 +				"array", "object", etc.
   2.187 +
   2.188 +			<li>
   2.189 +				Children of an object
   2.190 +				have their key as a class.
   2.191 +
   2.192 +			<li>
   2.193 +				Children of an array match the <a class=css data-link-type=maybe href=#first-child-pseudo title=:first-child>:first-child</a>, <a class=css data-link-type=maybe href=#nth-child-pseudo title=:nth-child()>:nth-child()</a>, etc pseudo-classes.
   2.194 +
   2.195 +			<li>
   2.196 +				The root object matches <a class=css data-link-type=maybe href=#root-pseudo title=:root>:root</a>.
   2.197 +
   2.198 +			<li>
   2.199 +				It additionally defines <span class=css data-link-type=maybe title=:val()>:val()</span> and <span class=css data-link-type=maybe title=:contains()>:contains()</span> pseudo-classes,
   2.200 +				for matching boolean/number/string elements with a particular value
   2.201 +				or which contain a particular substring.
   2.202 +		</ul>
   2.203 +
   2.204 +<p>		This structure is sufficient to allow powerful, compact querying of JSON documents with selectors.
   2.205 +	</div>
   2.206 +
   2.207  
   2.208  
   2.209  <h3 class="heading settled heading" data-level=3.4 id=scoping><span class=secno>3.4 </span><span class=content>
   2.210 @@ -3631,7 +3739,6 @@
   2.211  <li>:disabled, <a href=#disabled-pseudo title="section 11.1.1">11.1.1</a>
   2.212  <li>:drop(), <a href=#selectordef-drop title="section 9.4">9.4</a>
   2.213  <li>:drop, <a href=#selectordef-drop0 title="section 9.4">9.4</a>
   2.214 -<li>element tree, <a href=#element-tree title="section 3.3">3.3</a>
   2.215  <li>:empty, <a href=#empty-pseudo title="section 12.2">12.2</a>
   2.216  <li>:enabled, <a href=#enabled-pseudo title="section 11.1.1">11.1.1</a>
   2.217  <li>evaluate a selector, <a href=#evaluate-a-selector title="section 3.2">3.2</a>
   2.218 @@ -3742,7 +3849,13 @@
   2.219  	before something <em>is</em> exposed.
   2.220  
   2.221  
   2.222 -<a href=#issue-1bcc9de6> ↵ </a></div><div class=issue>
   2.223 +<a href=#issue-1bcc9de6> ↵ </a></div><div class=issue>			 Some pseudo-classes are *syntactical*,
   2.224 +			like <span class=css data-link-type=maybe title=:has()>:has()</span> and <a class=css data-link-type=maybe href=#matches-pseudo title=:matches()>:matches()</a>,
   2.225 +			and thus should always work.
   2.226 +			Need to indicate that somewhere.
   2.227 +			Probably the structural pseudos always work
   2.228 +			whenever the child list is ordered.
   2.229 +	<a href=#issue-66b7c28d> ↵ </a></div><div class=issue>
   2.230  		I’ve switched over to defaulting to allowing.
   2.231  		Is that okay,
   2.232  		or should we stick with defaulting to *not* allowing,

mercurial