- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Sun, 14 Feb 2010 12:01:50 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv9049
Modified Files:
Overview.html
Log Message:
Make dataset camelCase hyphenated names. (whatwg r4737)
Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3783
retrieving revision 1.3784
diff -u -d -r1.3783 -r1.3784
--- Overview.html 14 Feb 2010 11:24:32 -0000 1.3783
+++ Overview.html 14 Feb 2010 12:01:46 -0000 1.3784
@@ -7209,7 +7209,11 @@
any number of <a href="#custom-data-attribute" title="custom data attribute">custom data
attributes</a> specified, with any value.<hr><dl class="domintro"><dt><var title="">element</var> . <code title="dom-dataset"><a href="#dom-dataset">dataset</a></code></dt>
<dd>
+
<p>Returns a <code><a href="#domstringmap">DOMStringMap</a></code> object for the element's <code title="attr-data-*"><a href="#attr-data">data-*</a></code> attributes.</p>
+
+ <p>Hyphenated names become camel-cased. For example, <code title="">data-foo-bar=""</code> becomes <code title="">element.dataset.fooBar</code>.</p>
+
</dd>
</dl><div class="impl">
@@ -7228,10 +7232,19 @@
pairs.</li>
<li>For each content attribute on the element whose first five
- characters are the string "<code title="">data-</code>", add a
- name-value pair to <var title="">list</var> whose name is the
- attribute's name with the first five character removed and whose
- value is the attribute's value.</li>
+ characters are the string "<code title="">data-</code>" and whose
+ remaining characters (if any) do not include any characters in
+ the range U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN
+ CAPITAL LETTER Z), add a name-value pair to <var title="">list</var> whose name is the attribute's name with the
+ first five character removed and whose value is the attribute's
+ value.</li>
+
+ <li>For each name on the list, for each U+002D HYPHEN-MINUS
+ character (-) in the name that is followed by a character in the
+ range U+0061 to U+007A (U+0061 LATIN SMALL LETTER A to U+007A
+ LATIN SMALL LETTER Z), remove the U+002D HYPHEN-MINUS character
+ (-) and replace the character that followed it by the same
+ character <a href="#converted-to-ascii-uppercase">converted to ASCII uppercase</a>.</li>
<li>Return <var title="">list</var>.</li>
@@ -7240,13 +7253,26 @@
<dt>The algorithm for setting names to certain values</dt>
<dd>
- <ol><li>Let <var title="">name</var> be the concatenation of the
- string <code title="">data-</code> and the name passed to the
+ <ol><li>Let <var title="">name</var> be the name passed to the
algorithm.</li>
<li>Let <var title="">value</var> be the value passed to the
algorithm.</li>
+ <li>If <var title="">name</var> contains a U+002D HYPHEN-MINUS
+ character (-) followed by a character in the range U+0061 to
+ U+007A (U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
+ Z), throw a <code><a href="#syntax_err">SYNTAX_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li>For each character in the range U+0041 to U+005A (U+0041
+ LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z) in <var title="">name</var>, insert a U+002D HYPHEN-MINUS character (-)
+ before the character and replace the character with the same
+ character <a href="#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.</li>
+
+ <li>Insert the string <code title="">data-</code> at the front of
+ <var title="">name</var>.</li>
+
<li>Set the value of the attribute with the name <var title="">name</var>, to the value <var title="">value</var>,
replacing any previous value if the attribute already existed. If
<code title="">setAttribute()</code> would have raised an
@@ -7258,10 +7284,23 @@
<dt>The algorithm for deleting names</dt>
<dd>
- <ol><li>Let <var title="">name</var> be the concatenation of the
- string <code title="">data-</code> and the name passed to the
+ <ol><li>Let <var title="">name</var> be the name passed to the
algorithm.</li>
+ <li>If <var title="">name</var> contains a U+002D HYPHEN-MINUS
+ character (-) followed by a character in the range U+0061 to
+ U+007A (U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
+ Z), throw a <code><a href="#syntax_err">SYNTAX_ERR</a></code> exception and abort these
+ steps.</li>
+
+ <li>For each character in the range U+0041 to U+005A (U+0041
+ LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z) in <var title="">name</var>, insert a U+002D HYPHEN-MINUS character (-)
+ before the character and replace the character with the same
+ character <a href="#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.</li>
+
+ <li>Insert the string <code title="">data-</code> at the front of
+ <var title="">name</var>.</li>
+
<li>Remove the attribute with the name <var title="">name</var>,
if such an attribute exists. Do nothing otherwise.</li>
@@ -7274,15 +7313,18 @@
<p>If a Web page wanted an element to represent a space ship,
e.g. as part of a game, it would have to use the <code title="attr-class"><a href="#classes">class</a></code> attribute along with <code title="attr-data-*"><a href="#attr-data">data-*</a></code> attributes:</p>
- <pre><div class="spaceship" data-id="92432"
+ <pre><div class="spaceship" data-ship-id="92432"
data-weapons="laser 2" data-shields="50%"
data-x="30" data-y="10" data-z="90">
<button class="fire"
- onclick="spaceships[this.parentNode.dataset.id].fire()">
+ onclick="spaceships[this.parentNode.dataset.shipId].fire()">
Fire
</button>
</div></pre>
+ <p>Notice how the hyphenated attribute name becomes capitalized in
+ the API.</p>
+
</div><p>Authors should carefully design such extensions so that when the
attributes are ignored and any associated CSS dropped, the page is
still usable.<div class="impl">
@@ -67902,6 +67944,7 @@
Corprew Reed,
Craig Cockburn,
Csaba Gabor,
+ Csaba Marton,
Daniel Barclay,
Daniel Bratell,
Daniel Brooks,
Received on Sunday, 14 February 2010 12:01:51 UTC