spec/Overview.html 1.1946 2776 How to parse a color in an IE-compatible

How to parse a color in an IE-compatible way. (credit: sp) (whatwg
r2776)

Editor's Draft 11 February 2009
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1946.html#editor-s-draft-date-zzz-9-june-2008
A vocabulary and associated APIs for HTML and XHTML
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1946.html#a-vocabulary-and-associated-apis-for-html-and-xhtml
rules for parsing a legacy color value
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1946.html#rules-for-parsing-a-legacy-color-value
Status of this document
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1946.html#status-of-this-document
HTMLAnchorElement
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1946.html#htmlanchorelement

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.1945&r2=1.1946&f=h
http://html5.org/tools/web-apps-tracker?from=2775&to=2776

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1945
retrieving revision 1.1946
diff -u -d -r1.1945 -r1.1946
--- Overview.html 10 Feb 2009 22:17:19 -0000 1.1945
+++ Overview.html 11 Feb 2009 00:20:56 -0000 1.1946
@@ -10,7 +10,7 @@
    <p><a href=http://www.w3.org/><img alt=W3C height=48 src=http://www.w3.org/Icons/w3c_home width=72></a></p>
    <h1>HTML 5</h1>
    <h2 class="no-num no-toc" id=a-vocabulary-and-associated-apis-for-html-and-xhtml>A vocabulary and associated APIs for HTML and XHTML</h2>
-   <h2 class="no-num no-toc" id=editor-s-draft-date-zzz-9-june-2008><!-- "W3C Working Draft" --> Editor's Draft <!--ZZZ-->10 February 2009</h2>
+   <h2 class="no-num no-toc" id=editor-s-draft-date-zzz-9-june-2008><!-- "W3C Working Draft" --> Editor's Draft <!--ZZZ-->11 February 2009</h2>
    <dl><!-- ZZZ: update the month/day
     <dt>This Version:</dt>
     <dd><a href="http://www.w3.org/TR/2009/WD-html5-20090610/">http://www.w3.org/TR/2009/WD-html5-20090610/</a></dd>
@@ -99,7 +99,7 @@
   specification's progress along the W3C Recommendation
   track.
   <!--ZZZ:-->
-  This specification is the 10 February 2009 <!--ZZZ "Working Draft"-->Editor's Draft.
+  This specification is the 11 February 2009 <!--ZZZ "Working Draft"-->Editor's Draft.
   <!--:ZZZ-->
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href=http://www.whatwg.org/>WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
@@ -3248,7 +3248,99 @@
   value</dfn>, which are given in the following algorithm. When
   invoked, the steps must be followed in the order given, aborting at
   the first step that returns a value. This algorithm will either
-  return a <a href=#simple-color>simple color</a> or an error.<ol class=XXX><li>...
+  return a <a href=#simple-color>simple color</a> or an error.<ol><li><p>Let <var title="">input</var> be the string being
+   parsed.</li>
+
+   <li><p>If <var title="">input</var> is the empty string, then
+   return an error.</li>
+
+   <li><p>If <var title="">input</var> is an <a href=#ascii-case-insensitive>ASCII
+   case-insensitive</a> match for one of the keywords listed in the
+   <a href=http://www.w3.org/TR/css3-color/#svg-color>SVG color
+   keywords</a> section of the CSS3 Color specification, the return
+   the <a href=#simple-color>simple color</a> corresponding to that keyword. <a href=#references>[CSS3COLOR]</a></li>
+
+   <li>
+
+    <p>If <var title="">input</var> is four characters long, and the
+    first character in <var title="">input</var> is a U+0023 NUMBER
+    SIGN (#) character, and the the last three characters of <var title="">input</var> are all in the range U+0030 DIGIT ZERO (0)
+    .. U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A .. U+0046
+    LATIN CAPITAL LETTER F, and U+0061 LATIN SMALL LETTER A .. U+0066
+    LATIN SMALL LETTER F, then run these substeps:</p>
+
+    <ol><li><p>Let <var title="">result</var> be a <a href=#simple-color>simple
+     color</a>.</p>
+
+     <li><p>Interpret the second character of <var title="">input</var> as a hexadecimal digit; let the red
+     component of <var title="">result</var> be the resulting number
+     multiplied by 17.</p>
+
+     <li><p>Interpret the third character of <var title="">input</var>
+     as a hexadecimal digit; let the green component of <var title="">result</var> be the resulting number multiplied by
+     17.</p>
+
+     <li><p>Interpret the fourth character of <var title="">input</var> as a hexadecimal digit; let the blue
+     component of <var title="">result</var> be the resulting number
+     multiplied by 17.</p>
+
+     <li><p>Return <var title="">result</var>.</p>
+
+    </ol></li>
+
+   <li><p>Replace any characters in <var title="">input</var> that
+   have a Unicode codepoint greater than U+FFFF (i.e. any characters
+   that are not in the basic multilingual plane) with the
+   two-character string "<code title="">00</code>".</li>
+
+   <li><p>If <var title="">input</var> is longer than 128 characters,
+   truncate <var title="">input</var>, leaving only the first 128
+   characters.</li>
+
+   <li><p>If the first character in <var title="">input</var> is a
+   U+0023 NUMBER SIGN character (#), remove it.</li>
+
+   <li><p>Replace any character in <var title="">input</var> that is
+   not in the range U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9),
+   U+0041 LATIN CAPITAL LETTER A .. U+0046 LATIN CAPITAL LETTER F, and
+   U+0061 LATIN SMALL LETTER A .. U+0066 LATIN SMALL LETTER F with the
+   character U+0030 DIGIT ZERO (0).</li>
+
+   <li><p>While <var title="">input</var>'s length is zero or not a
+   multiple of three, append a U+0030 DIGIT ZERO (0) character to <var title="">input</var>.</li>
+
+   <li><p>Split <var title="">input</var> into three strings of equal
+   length, to obtain three components. Let <var title="">length</var>
+   be the length of those components (one third the length of <var title="">input</var>).</li>
+
+   <li><p>If <var title="">length</var> is greater than 8, then remove
+   the leading <span><var title="">length</var>-8</span> characters in
+   each component, and let <var title="">length</var> be 8.</li>
+
+   <li><p>While <var title="">length</var> is greater than two and the
+   first character in each component is a U+0030 DIGIT ZERO (0)
+   character, remove that character and reduce <var title="">length</var> by one.</li>
+
+   <li><p>If <var title="">length</var> is <em>still</em> greater than
+   two, truncate each component, leaving only the first two
+   characters in each.</li>
+
+   <li><p>Let <var title="">result</var> be a <a href=#simple-color>simple
+   color</a>.</p>
+
+   <li><p>Interpret the first component as a hexadecimal number; let
+   the red component of <var title="">result</var> be the resulting
+   number.</li>
+
+   <li><p>Interpret the second component as a hexadecimal number; let
+   the green component of <var title="">result</var> be the resulting
+   number.</li>
+
+   <li><p>Interpret the third component as a hexadecimal number; let
+   the blue component of <var title="">result</var> be the resulting
+   number.</li>
+
+   <li><p>Return <var title="">result</var>.</p>
 
   </ol><hr><p class=note>The <a href=#canvas-context-2d title=canvas-context-2d>2D graphics
   context</a> has a separate color syntax that also handles
@@ -10233,7 +10325,11 @@
    </dd>
   </dl><p>If the <code><a href=#the-a-element>a</a></code> element has an <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then it
   <a href=#represents>represents</a> a <a href=#hyperlink>hyperlink</a> (a hypertext
-  anchor).<p>If the <code><a href=#the-a-element>a</a></code> element has no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then the element
+  anchor).</p><!-- v2: Eric Meyer requests the ability to nest links so that a big
+  hyperlink, e.g. representing a calendar event, can be clickable,
+  while within it there are subareas that represent links to distinct
+  areas, e.g. a link to see photos of the event, or to edit the event,
+  or some such. --><p>If the <code><a href=#the-a-element>a</a></code> element has no <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, then the element
   <a href=#represents>represents</a> a placeholder for where a link might
   otherwise have been placed, if it had been relevant.<p>The <code title=attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>, <code title=attr-hyperlink-ping><a href=#ping>ping</a></code>, <code title=attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>, <code title=attr-hyperlink-media><a href=#attr-hyperlink-media>media</a></code>, <code title=attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code title=attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attributes must be omitted
   if the <code title=attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute is

Received on Wednesday, 11 February 2009 00:24:28 UTC