Skip to content
Permalink
Browse files
[giow] (0) Clarify handling of CSS colors.
git-svn-id: http://svn.whatwg.org/webapps@5726 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 29, 2010
1 parent ce72b69 commit 320060f12255762659b559394d0056a9e71c7736
Showing with 150 additions and 61 deletions.
  1. +49 −20 complete.html
  2. +49 −20 index
  3. +52 −21 source
@@ -3337,6 +3337,33 @@ <h4 id=dependencies><span class=secno>2.2.1 </span>Dependencies</h4>

</dd>

<dt>CSS modules</dt>

<dd>

<p>While support for CSS as a whole is not required of
implementations of this specification (though it is encouraged, at
least for Web browsers), some features are defined in terms of
specific CSS requirements.</p>

<p>In particular, some features require that a string be
<dfn id=parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt; value</dfn>. When parsing a CSS
value, user agents are required by the CSS specifications to apply
some error handling rules. These apply to this specification also.
<a href=#refsCSSCOLOR>[CSSCOLOR]</a> <a href=#refsCSS>[CSS]</a></p>

<p class=example>For example, user agents are required to close
all open constructs upon finding the end of a style sheet
unexpectedly. Thus, when parsing the string "<code title="">rgb(0,0,0</code>" (with a missing close-parenthesis) for
a color value, the close parenthesis is implied by this error
handling rule, and a value is obtained (the color 'black').
However, the similar construct "<code title="">rgb(0,0,</code>"
(with both a missing parenthesis and a missing "blue" value)
cannot be parsed, as it closing the open construct does not result
in a viable value.</p>

</dd>

</dl><p>This specification does not <em>require</em> support of any
particular network protocol, style sheet language, scripting
language, or any of the DOM specifications beyond those described
@@ -32045,13 +32072,14 @@ <h6 id=colors-and-styles><span class=secno>4.8.11.1.4 </span>Colors and styles</

<p>Both attributes can be either strings,
<code><a href=#canvasgradient>CanvasGradient</a></code>s, or <code><a href=#canvaspattern>CanvasPattern</a></code>s. On
setting, strings must be parsed as CSS &lt;color&gt; values and the
color assigned, and <code><a href=#canvasgradient>CanvasGradient</a></code> and
setting, strings must be <a href=#parsed-as-a-css-color-value title="parsed as a CSS <color>
value">parsed as CSS &lt;color&gt; values</a> and the color
assigned, and <code><a href=#canvasgradient>CanvasGradient</a></code> and
<code><a href=#canvaspattern>CanvasPattern</a></code> objects must be assigned themselves. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> If the value is a string but
is not a valid color, or is neither a string, a
<code><a href=#canvasgradient>CanvasGradient</a></code>, nor a <code><a href=#canvaspattern>CanvasPattern</a></code>, then
it must be ignored, and the attribute must retain its previous
value.</p>
cannot be <a href=#parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt; value</a>, or is
neither a string, a <code><a href=#canvasgradient>CanvasGradient</a></code>, nor a
<code><a href=#canvaspattern>CanvasPattern</a></code>, then it must be ignored, and the
attribute must retain its previous value.</p>

<p>When set to a <code><a href=#canvaspattern>CanvasPattern</a></code> or
<code><a href=#canvasgradient>CanvasGradient</a></code> object, the assignment is
@@ -32152,16 +32180,17 @@ <h6 id=colors-and-styles><span class=secno>4.8.11.1.4 </span>Colors and styles</
method on the <code><a href=#canvasgradient>CanvasGradient</a></code> interface adds a new stop
to a gradient. If the <var title="">offset</var> is less than 0,
greater than 1, infinite, or NaN, then an
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be raised. If the <var title="">color</var> cannot be parsed as a CSS color, then a
<code><a href=#syntax_err>SYNTAX_ERR</a></code> exception must be raised. Otherwise, the
gradient must have a new stop placed, at offset <var title="">offset</var> relative to the whole gradient, and with the
color obtained by parsing <var title="">color</var> as a CSS
&lt;color&gt; value. If multiple stops are added at the same offset
on a gradient, they must be placed in the order added, with the
first one closest to the start of the gradient, and each subsequent
one infinitesimally further along towards the end point (in effect
causing all but the first and last stop added at each point to be
ignored).</p>
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be raised. If the <var title="">color</var> cannot be <a href=#parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt;
value</a>, then a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception must be
raised. Otherwise, the gradient must have a new stop placed, at
offset <var title="">offset</var> relative to the whole gradient,
and with the color obtained by parsing <var title="">color</var> as
a CSS &lt;color&gt; value. If multiple stops are added at the same
offset on a gradient, they must be placed in the order added, with
the first one closest to the start of the gradient, and each
subsequent one infinitesimally further along towards the end point
(in effect causing all but the first and last stop added at each
point to be ignored).</p>

<p>The <dfn id=dom-context-2d-createlineargradient title=dom-context-2d-createLinearGradient><code>createLinearGradient(<var title="">x0</var>, <var title="">y0</var>, <var title="">x1</var>,
<var title="">y1</var>)</code></dfn> method takes four arguments
@@ -32579,10 +32608,10 @@ <h6 id=shadows><span class=secno>4.8.11.1.6 </span><dfn>Shadows</dfn></h6>
<p>On getting, the <a href=#serialization-of-a-color title="serialization of a
color">serialization of the color</a> must be returned.</p>

<p>On setting, the new value must be parsed as a CSS &lt;color&gt;
value and the color assigned. If the value is not a valid color,
then it must be ignored, and the attribute must retain its previous
value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
<p>On setting, the new value must be <a href=#parsed-as-a-css-color-value>parsed as a CSS
&lt;color&gt; value</a> and the color assigned. If the value
cannot be parsed as a CSS &lt;color&gt; value then it must be
ignored, and the attribute must retain its previous value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>

<p>The <dfn id=dom-context-2d-shadowoffsetx title=dom-context-2d-shadowOffsetX><code>shadowOffsetX</code></dfn>
and <dfn id=dom-context-2d-shadowoffsety title=dom-context-2d-shadowOffsetY><code>shadowOffsetY</code></dfn>
69 index
@@ -3316,6 +3316,33 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

</dd>

<dt>CSS modules</dt>

<dd>

<p>While support for CSS as a whole is not required of
implementations of this specification (though it is encouraged, at
least for Web browsers), some features are defined in terms of
specific CSS requirements.</p>

<p>In particular, some features require that a string be
<dfn id=parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt; value</dfn>. When parsing a CSS
value, user agents are required by the CSS specifications to apply
some error handling rules. These apply to this specification also.
<a href=#refsCSSCOLOR>[CSSCOLOR]</a> <a href=#refsCSS>[CSS]</a></p>

<p class=example>For example, user agents are required to close
all open constructs upon finding the end of a style sheet
unexpectedly. Thus, when parsing the string "<code title="">rgb(0,0,0</code>" (with a missing close-parenthesis) for
a color value, the close parenthesis is implied by this error
handling rule, and a value is obtained (the color 'black').
However, the similar construct "<code title="">rgb(0,0,</code>"
(with both a missing parenthesis and a missing "blue" value)
cannot be parsed, as it closing the open construct does not result
in a viable value.</p>

</dd>

</dl><p>This specification does not <em>require</em> support of any
particular network protocol, style sheet language, scripting
language, or any of the DOM specifications beyond those described
@@ -32027,13 +32054,14 @@ idea from Mihai:

<p>Both attributes can be either strings,
<code><a href=#canvasgradient>CanvasGradient</a></code>s, or <code><a href=#canvaspattern>CanvasPattern</a></code>s. On
setting, strings must be parsed as CSS &lt;color&gt; values and the
color assigned, and <code><a href=#canvasgradient>CanvasGradient</a></code> and
setting, strings must be <a href=#parsed-as-a-css-color-value title="parsed as a CSS <color>
value">parsed as CSS &lt;color&gt; values</a> and the color
assigned, and <code><a href=#canvasgradient>CanvasGradient</a></code> and
<code><a href=#canvaspattern>CanvasPattern</a></code> objects must be assigned themselves. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> If the value is a string but
is not a valid color, or is neither a string, a
<code><a href=#canvasgradient>CanvasGradient</a></code>, nor a <code><a href=#canvaspattern>CanvasPattern</a></code>, then
it must be ignored, and the attribute must retain its previous
value.</p>
cannot be <a href=#parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt; value</a>, or is
neither a string, a <code><a href=#canvasgradient>CanvasGradient</a></code>, nor a
<code><a href=#canvaspattern>CanvasPattern</a></code>, then it must be ignored, and the
attribute must retain its previous value.</p>

<p>When set to a <code><a href=#canvaspattern>CanvasPattern</a></code> or
<code><a href=#canvasgradient>CanvasGradient</a></code> object, the assignment is
@@ -32134,16 +32162,17 @@ idea from Mihai:
method on the <code><a href=#canvasgradient>CanvasGradient</a></code> interface adds a new stop
to a gradient. If the <var title="">offset</var> is less than 0,
greater than 1, infinite, or NaN, then an
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be raised. If the <var title="">color</var> cannot be parsed as a CSS color, then a
<code><a href=#syntax_err>SYNTAX_ERR</a></code> exception must be raised. Otherwise, the
gradient must have a new stop placed, at offset <var title="">offset</var> relative to the whole gradient, and with the
color obtained by parsing <var title="">color</var> as a CSS
&lt;color&gt; value. If multiple stops are added at the same offset
on a gradient, they must be placed in the order added, with the
first one closest to the start of the gradient, and each subsequent
one infinitesimally further along towards the end point (in effect
causing all but the first and last stop added at each point to be
ignored).</p>
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception must be raised. If the <var title="">color</var> cannot be <a href=#parsed-as-a-css-color-value>parsed as a CSS &lt;color&gt;
value</a>, then a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception must be
raised. Otherwise, the gradient must have a new stop placed, at
offset <var title="">offset</var> relative to the whole gradient,
and with the color obtained by parsing <var title="">color</var> as
a CSS &lt;color&gt; value. If multiple stops are added at the same
offset on a gradient, they must be placed in the order added, with
the first one closest to the start of the gradient, and each
subsequent one infinitesimally further along towards the end point
(in effect causing all but the first and last stop added at each
point to be ignored).</p>

<p>The <dfn id=dom-context-2d-createlineargradient title=dom-context-2d-createLinearGradient><code>createLinearGradient(<var title="">x0</var>, <var title="">y0</var>, <var title="">x1</var>,
<var title="">y1</var>)</code></dfn> method takes four arguments
@@ -32561,10 +32590,10 @@ hairline width with transform. ack Shaun Morris.
<p>On getting, the <a href=#serialization-of-a-color title="serialization of a
color">serialization of the color</a> must be returned.</p>

<p>On setting, the new value must be parsed as a CSS &lt;color&gt;
value and the color assigned. If the value is not a valid color,
then it must be ignored, and the attribute must retain its previous
value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
<p>On setting, the new value must be <a href=#parsed-as-a-css-color-value>parsed as a CSS
&lt;color&gt; value</a> and the color assigned. If the value
cannot be parsed as a CSS &lt;color&gt; value then it must be
ignored, and the attribute must retain its previous value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>

<p>The <dfn id=dom-context-2d-shadowoffsetx title=dom-context-2d-shadowOffsetX><code>shadowOffsetX</code></dfn>
and <dfn id=dom-context-2d-shadowoffsety title=dom-context-2d-shadowOffsetY><code>shadowOffsetY</code></dfn>
73 source
@@ -2289,6 +2289,35 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

</dd>

<dt>CSS modules</dt>

<dd>

<p>While support for CSS as a whole is not required of
implementations of this specification (though it is encouraged, at
least for Web browsers), some features are defined in terms of
specific CSS requirements.</p>

<p>In particular, some features require that a string be
<dfn>parsed as a CSS &lt;color&gt; value</dfn>. When parsing a CSS
value, user agents are required by the CSS specifications to apply
some error handling rules. These apply to this specification also.
<a href="#refsCSSCOLOR">[CSSCOLOR]</a> <a
href="#refsCSS">[CSS]</a></p>

<p class="example">For example, user agents are required to close
all open constructs upon finding the end of a style sheet
unexpectedly. Thus, when parsing the string "<code
title="">rgb(0,0,0</code>" (with a missing close-parenthesis) for
a color value, the close parenthesis is implied by this error
handling rule, and a value is obtained (the color 'black').
However, the similar construct "<code title="">rgb(0,0,</code>"
(with both a missing parenthesis and a missing "blue" value)
cannot be parsed, as it closing the open construct does not result
in a viable value.</p>

</dd>

</dl>

<p>This specification does not <em>require</em> support of any
@@ -35235,14 +35264,15 @@ idea from Mihai:

<p>Both attributes can be either strings,
<code>CanvasGradient</code>s, or <code>CanvasPattern</code>s. On
setting, strings must be parsed as CSS &lt;color&gt; values and the
color assigned, and <code>CanvasGradient</code> and
setting, strings must be <span title="parsed as a CSS &lt;color&gt;
value">parsed as CSS &lt;color&gt; values</span> and the color
assigned, and <code>CanvasGradient</code> and
<code>CanvasPattern</code> objects must be assigned themselves. <a
href="#refsCSSCOLOR">[CSSCOLOR]</a> If the value is a string but
is not a valid color, or is neither a string, a
<code>CanvasGradient</code>, nor a <code>CanvasPattern</code>, then
it must be ignored, and the attribute must retain its previous
value.</p>
cannot be <span>parsed as a CSS &lt;color&gt; value</span>, or is
neither a string, a <code>CanvasGradient</code>, nor a
<code>CanvasPattern</code>, then it must be ignored, and the
attribute must retain its previous value.</p>

<p>When set to a <code>CanvasPattern</code> or
<code>CanvasGradient</code> object, the assignment is
@@ -35356,17 +35386,17 @@ idea from Mihai:
to a gradient. If the <var title="">offset</var> is less than 0,
greater than 1, infinite, or NaN, then an
<code>INDEX_SIZE_ERR</code> exception must be raised. If the <var
title="">color</var> cannot be parsed as a CSS color, then a
<code>SYNTAX_ERR</code> exception must be raised. Otherwise, the
gradient must have a new stop placed, at offset <var
title="">offset</var> relative to the whole gradient, and with the
color obtained by parsing <var title="">color</var> as a CSS
&lt;color&gt; value. If multiple stops are added at the same offset
on a gradient, they must be placed in the order added, with the
first one closest to the start of the gradient, and each subsequent
one infinitesimally further along towards the end point (in effect
causing all but the first and last stop added at each point to be
ignored).</p>
title="">color</var> cannot be <span>parsed as a CSS &lt;color&gt;
value</span>, then a <code>SYNTAX_ERR</code> exception must be
raised. Otherwise, the gradient must have a new stop placed, at
offset <var title="">offset</var> relative to the whole gradient,
and with the color obtained by parsing <var title="">color</var> as
a CSS &lt;color&gt; value. If multiple stops are added at the same
offset on a gradient, they must be placed in the order added, with
the first one closest to the start of the gradient, and each
subsequent one infinitesimally further along towards the end point
(in effect causing all but the first and last stop added at each
point to be ignored).</p>

<p>The <dfn
title="dom-context-2d-createLinearGradient"><code>createLinearGradient(<var
@@ -35875,10 +35905,11 @@ hairline width with transform. ack Shaun Morris.
<p>On getting, the <span title="serialization of a
color">serialization of the color</span> must be returned.</p>

<p>On setting, the new value must be parsed as a CSS &lt;color&gt;
value and the color assigned. If the value is not a valid color,
then it must be ignored, and the attribute must retain its previous
value. <a href="#refsCSSCOLOR">[CSSCOLOR]</a></p>
<p>On setting, the new value must be <span>parsed as a CSS
&lt;color&gt; value</span> and the color assigned. If the value
cannot be parsed as a CSS &lt;color&gt; value then it must be
ignored, and the attribute must retain its previous value. <a
href="#refsCSSCOLOR">[CSSCOLOR]</a></p>

<p>The <dfn
title="dom-context-2d-shadowOffsetX"><code>shadowOffsetX</code></dfn>

0 comments on commit 320060f

Please sign in to comment.