[html5] r3628 - [e] (0) Add an example of how DOMTokenList works when reflecting attributes that [...]
whatwg at whatwg.org
whatwg at whatwg.org
Sat Aug 15 04:31:55 PDT 2009
Author: ianh
Date: 2009-08-15 04:31:54 -0700 (Sat, 15 Aug 2009)
New Revision: 3628
Modified:
index
source
Log:
[e] (0) Add an example of how DOMTokenList works when reflecting attributes that aren't there.
Modified: index
===================================================================
--- index 2009-08-15 11:12:42 UTC (rev 3627)
+++ index 2009-08-15 11:31:54 UTC (rev 3628)
@@ -5303,6 +5303,18 @@
empty string. The same <code><a href=#domtokenlist-0>DOMTokenList</a></code> object must be
returned every time for each attribute.</p>
+ <div class=example>
+
+ <p>If an element with no attributes has its <code title=dom-tokenlist-remove><a href=#dom-tokenlist-remove>element.classList.remove()</a></code>
+ method invoked, the underlying string won't be changed, since the
+ result of removing any token from the empty string is still the
+ empty string. However, if the <code title=dom-tokenlist-add><a href=#dom-tokenlist-add>element.classList.add()</a></code> method is
+ then invoked, a <code title=attr-class><a href=#classes>class</a></code> attribute
+ will be added to the element with the value of the token to be
+ added.</p>
+
+ </div>
+
<p>If a reflecting DOM attribute has the type
<code><a href=#htmlelement>HTMLElement</a></code>, or an interface that descends from
<code><a href=#htmlelement>HTMLElement</a></code>, then, on getting, it must run the
Modified: source
===================================================================
--- source 2009-08-15 11:12:42 UTC (rev 3627)
+++ source 2009-08-15 11:31:54 UTC (rev 3628)
@@ -5028,6 +5028,20 @@
empty string. The same <code>DOMTokenList</code> object must be
returned every time for each attribute.</p>
+ <div class="example">
+
+ <p>If an element with no attributes has its <code
+ title="dom-tokenlist-remove">element.classList.remove()</code>
+ method invoked, the underlying string won't be changed, since the
+ result of removing any token from the empty string is still the
+ empty string. However, if the <code
+ title="dom-tokenlist-add">element.classList.add()</code> method is
+ then invoked, a <code title="attr-class">class</code> attribute
+ will be added to the element with the value of the token to be
+ added.</p>
+
+ </div>
+
<p>If a reflecting DOM attribute has the type
<code>HTMLElement</code>, or an interface that descends from
<code>HTMLElement</code>, then, on getting, it must run the
More information about the Commit-Watchers
mailing list