[html5] r4737 - [agiow] (0) Make dataset camelCase hyphenated names. Fixing http://www.w3.org/Bu [...]

whatwg at whatwg.org whatwg at whatwg.org
Sun Feb 14 04:01:43 PST 2010


Author: ianh
Date: 2010-02-14 04:01:41 -0800 (Sun, 14 Feb 2010)
New Revision: 4737

Modified:
   complete.html
   index
   source
Log:
[agiow] (0) Make dataset camelCase hyphenated names.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=8924

Modified: complete.html
===================================================================
--- complete.html	2010-02-14 11:24:26 UTC (rev 4736)
+++ complete.html	2010-02-14 12:01:41 UTC (rev 4737)
@@ -8418,7 +8418,11 @@
 
   <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>
@@ -8437,11 +8441,20 @@
      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>
 
     </ol></dd>
@@ -8449,13 +8462,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
@@ -8467,10 +8493,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>
 
@@ -8485,15 +8524,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
@@ -88356,6 +88398,7 @@
   Corprew Reed,
   Craig Cockburn,
   Csaba Gabor,
+  Csaba Marton,
   Daniel Barclay,
   Daniel Bratell,
   Daniel Brooks,

Modified: index
===================================================================
--- index	2010-02-14 11:24:26 UTC (rev 4736)
+++ index	2010-02-14 12:01:41 UTC (rev 4737)
@@ -8317,7 +8317,11 @@
 
   <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>
@@ -8336,11 +8340,20 @@
      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>
 
     </ol></dd>
@@ -8348,13 +8361,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
@@ -8366,10 +8392,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>
 
@@ -8384,15 +8423,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
@@ -82824,6 +82866,7 @@
   Corprew Reed,
   Craig Cockburn,
   Csaba Gabor,
+  Csaba Marton,
   Daniel Barclay,
   Daniel Bratell,
   Daniel Brooks,

Modified: source
===================================================================
--- source	2010-02-14 11:24:26 UTC (rev 4736)
+++ source	2010-02-14 12:01:41 UTC (rev 4737)
@@ -8407,7 +8407,13 @@
 
    <dt><var title="">element</var> . <code title="dom-dataset">dataset</code></dt>
    <dd>
+
     <p>Returns a <code>DOMStringMap</code> object for the element's <code title="attr-data-*">data-*</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>
@@ -8433,11 +8439,21 @@
      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 <span>converted to ASCII uppercase</span>.</li>
+
      <li>Return <var title="">list</var>.</li>
 
     </ol>
@@ -8448,13 +8464,27 @@
    <dd>
     <ol>
 
-     <li>Let <var title="">name</var> be the concatenation of the
-     string <code title="">data-</code> and the name passed to the
+     <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>SYNTAX_ERR</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 <span>converted to ASCII lowercase</span>.</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
@@ -8471,10 +8501,24 @@
    <dd>
     <ol>
 
-     <li>Let <var title="">name</var> be the concatenation of the
-     string <code title="">data-</code> and the name passed to the
+     <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>SYNTAX_ERR</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 <span>converted to ASCII lowercase</span>.</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>
 
@@ -8494,15 +8538,18 @@
    title="attr-class">class</code> attribute along with <code
    title="attr-data-*">data-*</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
@@ -98958,6 +99005,7 @@
   Corprew Reed,
   Craig Cockburn,
   Csaba Gabor,
+  Csaba Marton,
   Daniel Barclay,
   Daniel Bratell,
   Daniel Brooks,




More information about the Commit-Watchers mailing list