Short URL: http://html5.org/r/2695
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 2695 | Add more text about rationale for data-*='' attributes. | 2009-01-23 01:01 |
Index: source =================================================================== --- source (revision 2694) +++ source (revision 2695) @@ -7136,7 +7136,7 @@ title="attr-data-*"><code>data-</code></dfn>", has at least one character after the hyphen, is <span>XML-compatible</span>, has no namespace, and contains no characters in the range U+0041 .. U+005A - (LATIN CAPITAL LETTER A LATIN CAPITAL LETTER Z).</p> + (LATIN CAPITAL LETTER A .. LATIN CAPITAL LETTER Z).</p> <p class="note">All attributes in <span>HTML documents</span> get lowercased automatically, so the restriction on uppercase letters @@ -7147,6 +7147,32 @@ application, for which there are no more appropriate attributes or elements.</p> + <p>These attributes are not intended for use by software that is + independent of the site that uses the attributes.</p> + + <div class="example"> + + <p>For instance, a site about music could annotate list items + representing tracks in an album with custom data attributes + containing the length of each track. This information could then be + used by the site itself to allow the user to sort the list by track + length, or to filter the list for tracks of certain lengths.</p> + + <pre><ol> + <li data-length="2m11s">Beyond The Sea</li> + ... +</ol></pre> + + <p>It would be inappropriate, however, for the user to use generic + software not associated with that music site to search for tracks + of a certain length by looking at this data.</p> + + <p>This is because these attributes are intended for use by the + site's own scripts, and are not a generic extension mechanism for + publicly-usable metadata.</p> + + </div> + <p>Every <span title="HTML elements">HTML element</span> may have any number of <span title="custom data attribute">custom data attributes</span> specified, with any value.</p>