Skip to content

Commit fc8a258

Browse files
committed
Better definition for class attribute.
1 parent 396219a commit fc8a258

2 files changed

Lines changed: 20 additions & 38 deletions

File tree

selectors4/Overview.html

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,25 +1560,17 @@ <h3 id=def-values><span class=secno>6.4. </span> Default attribute values
15601560

15611561
<h3 id=class-html><span class=secno>6.5. </span> Class selectors</h3>
15621562

1563-
<p>Working with HTML, authors may use the "period" notation (also known as
1564-
"full stop", U+002E, <code>.</code>) as an alternative to the
1565-
<code>~=</code> notation when representing the <code>class</code>
1566-
attribute. Thus, for HTML, <code>div.value</code> and
1567-
<code>div[class~=value]</code> have the same meaning. The attribute value
1568-
must immediately follow the full stop (<code>.</code>).
1569-
1570-
<p>UAs may apply selectors using the period (.) notation in XML documents
1571-
if the UA has namespace-specific knowledge that allows it to determine
1572-
which attribute is the "class" attribute for the respective namespace. One
1573-
such example of namespace-specific knowledge is the prose in the
1574-
specification for a particular namespace (e.g. SVG 1.0 <a href="#SVG11"
1575-
rel=biblioentry>[SVG11]<!--{{SVG11}}--></a> describes the <a
1576-
href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
1577-
<code>class</code> attribute</a> and how a UA should interpret it, and
1578-
similarly MathML 1.01 <a href="#MATHML"
1579-
rel=biblioentry>[MATHML]<!--{{MATHML}}--></a> describes the <a
1580-
href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
1581-
<code>class</code> attribute</a>.)
1563+
<p>The class selector is given as a full stop (. U+002E) immediately
1564+
followed by an identifier. It represents an element belonging to the class
1565+
identified by the identifier, as defined by the document language. For
1566+
example, in <a href="#HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>,
1567+
<a href="#SVG11" rel=biblioentry>[SVG11]<!--{{SVG11}}--></a>, and <a
1568+
href="#MATHML" rel=biblioentry>[MATHML]<!--{{MATHML}}--></a> membership in
1569+
a class is given by the <code>class</code> attribute: in these languages
1570+
it is equivalent to the <code>~=</code> notation applied to the local
1571+
<code>class</code> attribute (i.e.
1572+
<code>[class~=<var>identifier</var>]</code>), except that it has a higher
1573+
<a href="#specificity">specificity</a>.
15821574

15831575
<div class=example>
15841576
<p>CSS examples:</p>

selectors4/Overview.src.html

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,25 +1080,15 @@ <h3 id=def-values>
10801080
<h3 id=class-html>
10811081
Class selectors</h3>
10821082

1083-
<p>Working with HTML, authors may use the "period" notation (also
1084-
known as "full stop", U+002E, <code>.</code>) as an alternative to the
1085-
<code>~=</code> notation when representing the <code>class</code>
1086-
attribute. Thus, for HTML, <code>div.value</code> and
1087-
<code>div[class~=value]</code> have the same meaning. The attribute
1088-
value must immediately follow the full stop
1089-
(<code>.</code>).</p>
1090-
1091-
<p>UAs may apply selectors using the period (.) notation in XML
1092-
documents if the UA has namespace-specific knowledge that allows it to
1093-
determine which attribute is the "class" attribute for the
1094-
respective namespace. One such example of namespace-specific knowledge
1095-
is the prose in the specification for a particular namespace (e.g. SVG
1096-
1.0 [[SVG11]] describes the <a
1097-
href="http://www.w3.org/TR/2001/PR-SVG-20010719/styling.html#ClassAttribute">SVG
1098-
<code>class</code> attribute</a> and how a UA should interpret it, and
1099-
similarly MathML 1.01 [[MATHML]] describes the <a
1100-
href="http://www.w3.org/1999/07/REC-MathML-19990707/chapter2.html#sec2.3.4">MathML
1101-
<code>class</code> attribute</a>.)</p>
1083+
<p>The class selector is given as a full stop (. U+002E) immediately
1084+
followed by an identifier. It represents an element belonging to the
1085+
class identified by the identifier, as defined by the document language.
1086+
For example, in [[HTML5]], [[SVG11]], and [[MATHML]] membership in a
1087+
class is given by the <code>class</code> attribute: in these languages
1088+
it is equivalent to the <code>~=</code> notation applied to the
1089+
local <code>class</code> attribute
1090+
(i.e. <code>[class~=<var>identifier</var>]</code>),
1091+
except that it has a higher <a href="#specificity">specificity</a>.
11021092

11031093
<div class="example">
11041094
<p>CSS examples:</p>

0 commit comments

Comments
 (0)