Browse files

[e] (0) Add more text about rationale for data-*='' attributes.

git-svn-id: http://svn.whatwg.org/webapps@2695 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent 1f0ee39 commit 53a1ff50fb07ed657a30c86bea546dd5e147337f @Hixie Hixie committed Jan 23, 2009
Showing with 54 additions and 2 deletions.
  1. +27 −1 index
  2. +27 −1 source
View
28 index
@@ -7022,7 +7022,7 @@ background: transparent"&gt;blue&lt;/span&gt;.&lt;/p&gt;</pre>
starts with the string "<dfn id=attr-data-* title=attr-data-*><code>data-</code></dfn>", has at least one
character after the hyphen, is <a href=#xml-compatible>XML-compatible</a>, 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 <a href=#html-documents>HTML documents</a> get
lowercased automatically, so the restriction on uppercase letters
@@ -7033,6 +7033,32 @@ background: transparent"&gt;blue&lt;/span&gt;.&lt;/p&gt;</pre>
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>&lt;ol&gt;
+ &lt;li data-length="2m11s"&gt;Beyond The Sea&lt;/li&gt;
+ ...
+&lt;/ol&gt;</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 <a href=#html-elements title="HTML elements">HTML element</a> may have
any number of <a href=#custom-data-attribute title="custom data attribute">custom data
attributes</a> specified, with any value.</p>
View
28 source
@@ -7136,7 +7136,7 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
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 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
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>&lt;ol>
+ &lt;li data-length="2m11s">Beyond The Sea&lt;/li>
+ ...
+&lt;/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>

0 comments on commit 53a1ff5

Please sign in to comment.