Permalink
Browse files

Define more precisely what happens when setting id="" and class="" at…

  • Loading branch information...
annevk committed Dec 7, 2012
1 parent 0f43c35 commit 25d3e7c0ec9cb92373e30c7bc9a3bc90840072e3
Showing with 76 additions and 36 deletions.
  1. +38 −18 Overview.src.html
  2. +38 −18 dom-core.html
View
@@ -4900,38 +4900,58 @@ <h3>Interface <code>Element</code></h3>
<hr>
-<p><span title=concept-element>Elements</span> can have a
-<dfn title=concept-id>unique identifier (ID)</dfn> and
-<dfn title=concept-class>classes</dfn> associated with them.
+<p><span title=concept-element>Elements</span> can have an associated
+<dfn title=concept-id>unique identifier (ID)</dfn> and have an associated
+<code>DOMTokenList</code> object. The <code>DOMTokenList</code> object's
+associated <span title=concept-attribute>attribute</span> is the
+<span title=concept-named-attribute><code>class</code> attribute</span> and
+its associated list of unique tokens is called the
+<span title=concept-element>element</span>'s
+<dfn title=concept-class>classes</dfn>.
<p class=note>Historically <span title=concept-element>elements</span> could
have multiple identifiers e.g. by using the HTML <code title>id</code>
<span title=concept-attribute>attribute</span> and a DTD. This specification
makes <span title=concept-id>ID</span> a concept of the DOM and allows for
only one per <span title=concept-element>element</span>, given by an
-<code title>id</code> <span title=concept-attribute>attribute</span>.
+<span title=concept-named-attribute><code>id</code> attribute</span>.
-<p>An <span title=concept-element>element</span> has an
-<span title=concept-id>ID</span> if it
+<p>Either when an <span title=concept-element>element</span> is created that
<span title=concept-element-attribute-has>has</span> an
<span title=concept-named-attribute><code>id</code> attribute</span> whose
-<span title=concept-attribute-value>value</span> is not the empty string.
-The <span title=concept-id>ID</span> is that
-<span title=concept-attribute>attribute</span>'s
+<span title=concept-attribute-value>value</span> is not the empty string or
+when an <span title=concept-element>element</span>'s
+<span title=concept-named-attribute><code>id</code> attribute</span> is
+<span title="attribute is set">set</span> to a
+<span title=concept-attribute-value>value</span> other than the empty
+string, set the <span title=concept-element>element</span>'s
+<span title=concept-id>ID</span> to the new
<span title=concept-attribute-value>value</span>.
-<p>An <span title=concept-element>element</span> has
-<span title=concept-class>classes</span> if it
+<p>When an <span title=concept-element>element</span>'s
+<span title=concept-named-attribute><code>id</code> attribute</span> is
+<span title="attribute is removed">removed</span>, unset the
+<span title=concept-element>element</span>'s
+<span title=concept-id>ID</span>.
+
+<p>Either when an <span title=concept-element>element</span> is created that
<span title=concept-element-attribute-has>has</span> a
-<span title=concept-named-attribute><code>class</code> attribute</span>, and
-<span title=concept-set-parser>parsing</span> that
-<span title=concept-attribute>attribute</span>'s
-<span title=concept-attribute-value>value</span> does not return an empty
-set. The <span title=concept-class>classes</span> are that
-<span title=concept-attribute>attribute</span>'s
-<span title=concept-attribute-value>value</span>
+<span title=concept-named-attribute><code>class</code> attribute</span> or
+when an <span title=concept-element>element</span>'s
+<span title=concept-named-attribute><code>class</code> attribute</span> is
+<span title="attribute is set">set</span> to a
+<span title=concept-attribute-value>value</span> other than the empty
+string, set the <span title=concept-element>element</span>'s
+<span title=concept-class>classes</span> to the new
+<span title=concept-attribute-value>value</span>,
<span title=concept-set-parser>parsed</span>.
+<p>When an <span title=concept-element>element</span>'s
+<span title=concept-named-attribute><code>class</code> attribute</span> is
+<span title="attribute is removed">removed</span>, set the
+<span title=concept-element>element</span>'s
+<span title=concept-class>classes</span> to the empty list.
+
<p class=note>While this specification defines user agent processing
requirements for <code title>id</code> and <code title>class</code>
<span title=concept-attribute>attributes</span> on any
View
@@ -4960,38 +4960,58 @@ <h3 id="interface-element"><span class="secno">5.8 </span>Interface <code><a hre
<hr>
-<p><a href="#concept-element" title="concept-element">Elements</a> can have a
-<dfn id="concept-id" title="concept-id">unique identifier (ID)</dfn> and
-<dfn id="concept-class" title="concept-class">classes</dfn> associated with them.
+<p><a href="#concept-element" title="concept-element">Elements</a> can have an associated
+<dfn id="concept-id" title="concept-id">unique identifier (ID)</dfn> and have an associated
+<code><a href="#domtokenlist">DOMTokenList</a></code> object. The <code><a href="#domtokenlist">DOMTokenList</a></code> object's
+associated <a href="#concept-attribute" title="concept-attribute">attribute</a> is the
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>class</code> attribute</a> and
+its associated list of unique tokens is called the
+<a href="#concept-element" title="concept-element">element</a>'s
+<dfn id="concept-class" title="concept-class">classes</dfn>.
<p class="note">Historically <a href="#concept-element" title="concept-element">elements</a> could
have multiple identifiers e.g. by using the HTML <code title="">id</code>
<a href="#concept-attribute" title="concept-attribute">attribute</a> and a DTD. This specification
makes <a href="#concept-id" title="concept-id">ID</a> a concept of the DOM and allows for
only one per <a href="#concept-element" title="concept-element">element</a>, given by an
-<code title="">id</code> <a href="#concept-attribute" title="concept-attribute">attribute</a>.
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>id</code> attribute</a>.
-<p>An <a href="#concept-element" title="concept-element">element</a> has an
-<a href="#concept-id" title="concept-id">ID</a> if it
+<p>Either when an <a href="#concept-element" title="concept-element">element</a> is created that
<a href="#concept-element-attribute-has" title="concept-element-attribute-has">has</a> an
<a href="#concept-named-attribute" title="concept-named-attribute"><code>id</code> attribute</a> whose
-<a href="#concept-attribute-value" title="concept-attribute-value">value</a> is not the empty string.
-The <a href="#concept-id" title="concept-id">ID</a> is that
-<a href="#concept-attribute" title="concept-attribute">attribute</a>'s
+<a href="#concept-attribute-value" title="concept-attribute-value">value</a> is not the empty string or
+when an <a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>id</code> attribute</a> is
+<a href="#attribute-is-set" title="attribute is set">set</a> to a
+<a href="#concept-attribute-value" title="concept-attribute-value">value</a> other than the empty
+string, set the <a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-id" title="concept-id">ID</a> to the new
<a href="#concept-attribute-value" title="concept-attribute-value">value</a>.
-<p>An <a href="#concept-element" title="concept-element">element</a> has
-<a href="#concept-class" title="concept-class">classes</a> if it
+<p>When an <a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>id</code> attribute</a> is
+<a href="#attribute-is-removed" title="attribute is removed">removed</a>, unset the
+<a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-id" title="concept-id">ID</a>.
+
+<p>Either when an <a href="#concept-element" title="concept-element">element</a> is created that
<a href="#concept-element-attribute-has" title="concept-element-attribute-has">has</a> a
-<a href="#concept-named-attribute" title="concept-named-attribute"><code>class</code> attribute</a>, and
-<a href="#concept-set-parser" title="concept-set-parser">parsing</a> that
-<a href="#concept-attribute" title="concept-attribute">attribute</a>'s
-<a href="#concept-attribute-value" title="concept-attribute-value">value</a> does not return an empty
-set. The <a href="#concept-class" title="concept-class">classes</a> are that
-<a href="#concept-attribute" title="concept-attribute">attribute</a>'s
-<a href="#concept-attribute-value" title="concept-attribute-value">value</a>
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>class</code> attribute</a> or
+when an <a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>class</code> attribute</a> is
+<a href="#attribute-is-set" title="attribute is set">set</a> to a
+<a href="#concept-attribute-value" title="concept-attribute-value">value</a> other than the empty
+string, set the <a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-class" title="concept-class">classes</a> to the new
+<a href="#concept-attribute-value" title="concept-attribute-value">value</a>,
<a href="#concept-set-parser" title="concept-set-parser">parsed</a>.
+<p>When an <a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-named-attribute" title="concept-named-attribute"><code>class</code> attribute</a> is
+<a href="#attribute-is-removed" title="attribute is removed">removed</a>, set the
+<a href="#concept-element" title="concept-element">element</a>'s
+<a href="#concept-class" title="concept-class">classes</a> to the empty list.
+
<p class="note">While this specification defines user agent processing
requirements for <code title="">id</code> and <code title="">class</code>
<a href="#concept-attribute" title="concept-attribute">attributes</a> on any

0 comments on commit 25d3e7c

Please sign in to comment.