Skip to content

Commit

Permalink
[acgiowt] (0) Update the requirements on <meter> and <progress> conte…
Browse files Browse the repository at this point in the history
…nts to fix reported problems.

git-svn-id: http://svn.whatwg.org/webapps@4163 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 18, 2009
1 parent 6d310c5 commit 94d4620
Show file tree
Hide file tree
Showing 3 changed files with 342 additions and 112 deletions.
147 changes: 111 additions & 36 deletions complete.html
Expand Up @@ -3130,10 +3130,10 @@ <h5 id=ratios><span class=secno>2.4.4.4 </span>Ratios</h5>
DIGIT NINE (9), and assign this string of one or more characters to
<var title="">string</var>.</li>

<li>If <var title="">string</var> consists of just a single U+002E
FULL STOP character or if it contains more than one U+002E FULL
STOP character then return an error condition and abort these
steps.</li>
<li>If the first character of <var title="">string</var> is a
U+002E FULL STOP character, or if <var title="">string</var>
contains more than one U+002E FULL STOP character, then return an
error condition and abort these steps.</li>

<li>Parse <var title="">string</var> according to the <a href=#rules-for-parsing-floating-point-number-values>rules
for parsing floating point number values</a>, to obtain <var title="">number</var>. This step cannot fail (<var title="">string</var> is guaranteed to be a <a href=#valid-floating-point-number>valid floating
Expand Down Expand Up @@ -17143,13 +17143,73 @@ <h4 id=the-progress-element><span class=secno>4.6.18 </span>The <dfn><code>progr
</div>

<p><span class=impl><strong>Author requirements</strong>:</span>
The <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> and <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attributes, when present,
must have values that are <a href=#valid-floating-point-number title="valid floating point
number">valid floating point numbers</a>. The <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, if present, must
have a value greater than zero. The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute, if present, must
The <code><a href=#the-progress-element>progress</a></code> element must match one of the following
conditions.</p>

<ul><li>Neither the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
attribute nor the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute is specified, and the element's contents
contain no numbers.</li>

<li>Neither the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
attribute nor the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute is specified, and the element's contents contain one
number, optionally followed by a <a href=#valid-denominator-punctuation-character title="valid denominator
punctuation character">denominator punctuation
character</a>.</li>

<li>Neither the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
attribute nor the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute is specified, and the element's contents contain two
numbers, neither followed by a <a href=#valid-denominator-punctuation-character title="valid denominator
punctuation character">denominator punctuation
character</a>.</li>

<li>The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute is
not specified but the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute is specified, and the element's contents
contain one number that is not followed by a <a href=#valid-denominator-punctuation-character title="valid
denominator punctuation character">denominator punctuation
character</a>.</li>

<li>The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute
and the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute are
both specified. (The contents of the element are ignored.)</li>

</ul><p>For the purposes of these requirements, a number is a sequence of
characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE
(9), optionally including a single U+002E FULL STOP character (.) in
some position after the first digit, interpreted as a base ten
number. Numbers must be separated from other numbers by at least one
character that isn't any of the aforementioned. In addition, if the
element is required to contain numbers, then the contents of the
element must not contain any U+002E FULL STOP characters (.) that
aren't part of numbers.</p>

<p>A number if said to be followed by a <a href=#valid-denominator-punctuation-character title="valid
denominator punctuation character">denominator punctuation
character</a> if it is followed by zero or more
<a href=#white_space>White_Space</a> characters and a <a href=#valid-denominator-punctuation-character>valid denominator
punctuation character</a>.</p>

<p>The contents of the element consist of the concatenation of
the <a href=#text-node title="text node">text nodes</a> of all the descendants
of the element, in <a href=#tree-order>tree order</a>.</p>

<p>The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> and <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attributes, when present, must
have values that are <a href=#valid-floating-point-number title="valid floating point number">valid
floating point numbers</a>. The <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute, if present, must
have a value equal to or greater than zero, and less than or equal
to the value of the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code>
attribute, if present, or 1, otherwise.</p>
attribute, if present, or 1.0, otherwise. If the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute is not present,
but the element's contents contain a number, then the value of the
first number in the element's contents must be less than or equal to
the value of the second number in the element's contents, if any, or
the <a href=#values-associated-with-denominator-punctuation-characters title="values associated with denominator punctuation
characters">value associated with the denominator punctuation
character</a> that follows the first number in the element's
contents, if any, or 1.0, otherwise. The <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute, if present, must
have a value greater than zero.</p>

<p class=note>The <code><a href=#the-progress-element>progress</a></code> element is the wrong
element to use for something that is just a gauge, as opposed to
Expand All @@ -17169,7 +17229,8 @@ <h4 id=the-progress-element><span class=secno>4.6.18 </span>The <dfn><code>progr
<code>textContent</code> of the <code><a href=#the-progress-element>progress</a></code> element in
question using the <a href=#steps-for-finding-one-or-two-numbers-of-a-ratio-in-a-string>steps for finding one or two numbers of a
ratio in a string</a>. These steps will return nothing, one
number, one number with a denominator punctuation character, or two
number, one number with a <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>, or two
numbers.</p>

<p>Using the results of this processing, user agents must determine
Expand Down Expand Up @@ -17197,8 +17258,8 @@ <h4 id=the-progress-element><span class=secno>4.6.18 </span>The <dfn><code>progr

<li>Otherwise, if neither attribute is included, then, if the
<code>textContent</code> contained one number with an associated
denominator punctuation character, then the maximum value is the
<a href=#values-associated-with-denominator-punctuation-characters title="values associated with denominator punctuation
<a href=#valid-denominator-punctuation-character title="valid denominator punctuation character">denominator
punctuation character</a>, then the maximum value is the <a href=#values-associated-with-denominator-punctuation-characters title="values associated with denominator punctuation
characters">value associated with that denominator punctuation
character</a>; otherwise, if the <code>textContent</code>
contained two numbers, the maximum value is the higher of the two
Expand All @@ -17213,7 +17274,8 @@ <h4 id=the-progress-element><span class=secno>4.6.18 </span>The <dfn><code>progr
<li>Otherwise if the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code>
attribute is absent and the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute is present, then, if
the <code>textContent</code> was parsed and found to contain just
one number, with no associated denominator punctuation character,
one number, with no associated <a href=#valid-denominator-punctuation-character title="valid denominator
punctuation character">denominator punctuation character</a>,
then the current value is that number. Otherwise, if the <code title=attr-progress-value><a href=#attr-progress-value>value</a></code> attribute is absent and
the <code title=attr-progress-max><a href=#attr-progress-max>max</a></code> attribute is present
then the current value is zero.</li>
Expand Down Expand Up @@ -17357,12 +17419,14 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
be less than or equal to the value of the <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> attribute.</p>

<p>The numbers in the contents of the element must not be followed
by denomination punctuation characters.</p>
by a <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>.</p>

</dd>

<dt>There is exactly one number followed by a denomination
punctuation character in the contents of the element, and the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>, <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, and <code title=attr-meter-max><a href=#attr-meter-max>max</a></code> attributes are all omitted</dt>
<dt>There is exactly one number followed by a <a href=#valid-denominator-punctuation-character title="valid
denominator punctuation character">denominator punctuation
character</a> in the contents of the element, and the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>, <code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, and <code title=attr-meter-max><a href=#attr-meter-max>max</a></code> attributes are all omitted</dt>

<dd>

Expand Down Expand Up @@ -17400,8 +17464,10 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
attribute is specified, then the <var title="">maximum</var> is
that attribute's value; otherwise, it is 1.</p>

<p>If there is exactly one number in the contents of the element,
then <var title="">value</var> is that number; otherwise, <var title="">value</var> is the value of the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute.</p>
<p>If the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute is
specified, then the <var title="">value</var> is that attribute's
number; otherwise, there is exactly one number in the contents of
the element, and the <var title="">value</var> is that number.</p>

<p>The following inequalities must hold, as applicable:</p>

Expand All @@ -17413,8 +17479,12 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
the <code title=attr-meter-low><a href=#attr-meter-low>low</a></code> attribute's value must
be less than or equal to the value of the <code title=attr-meter-high><a href=#attr-meter-high>high</a></code> attribute.</p>

<p>If there is a number in the contents of the element, it must
not be followed by a denominator punctuation character.</p>
<p>If the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attribute is
not specified, the number in the contents of the element must not
be followed by a <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>. (Otherwise,
there is no restriction on what numbers can be in the contents of
the element.)</p>

</dd>

Expand All @@ -17423,9 +17493,10 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
(9), optionally including a single U+002E FULL STOP character (.) in
some position after the first digit, interpreted as a base ten
number. Numbers must be separated from other numbers by at least one
character that isn't any of the aforementioned. In addition, the
contents of the element must not contain any U+002E FULL STOP
characters (.) that aren't part of numbers.</p>
character that isn't any of the aforementioned. In addition, if the
element is required to contain numbers, then the contents of the
element must not contain any U+002E FULL STOP characters (.) that
aren't part of numbers.</p>

<p>A number if said to be followed by a <a href=#valid-denominator-punctuation-character title="valid
denominator punctuation character">denominator punctuation
Expand Down Expand Up @@ -17503,8 +17574,8 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
been omitted, the user agent must also process the
<code>textContent</code> of the element according to the <a href=#steps-for-finding-one-or-two-numbers-of-a-ratio-in-a-string>steps
for finding one or two numbers of a ratio in a string</a>. These
steps will return nothing, one number, one number with a denominator
punctuation character, or two numbers.</p>
steps will return nothing, one number, one number with a <a href=#valid-denominator-punctuation-character title="valid denominator punctuation character">denominator
punctuation character</a>, or two numbers.</p>

<p>User agents must then use all these numbers to obtain values for
six points on the gauge, as follows. (The order in which these are
Expand Down Expand Up @@ -17536,14 +17607,16 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
<code title=attr-meter-min><a href=#attr-meter-min>min</a></code>, and <code title=attr-meter-value><a href=#attr-meter-value>value</a></code> attributes were
specified. If the result of processing the
<code>textContent</code> of the element was either nothing or just
one number with no denominator punctuation character, then the
one number with no <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>, then the
maximum value is 1; if the result was one number but it had an
associated denominator punctuation character, then the maximum
value is the <a href=#values-associated-with-denominator-punctuation-characters title="values associated with denominator
punctuation characters">value associated with that denominator
punctuation character</a>; and finally, if there were two
numbers parsed out of the <code>textContent</code>, then the
maximum is the higher of those two numbers.</p>
associated <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>, then the
maximum value is the <a href=#values-associated-with-denominator-punctuation-characters title="values associated with
denominator punctuation characters">value associated with that
denominator punctuation character</a>; and finally, if there
were two numbers parsed out of the <code>textContent</code>, then
the maximum is the higher of those two numbers.</p>

<p>If the above machinations result in a maximum value less than
the minimum value, then the maximum value is actually the same as
Expand All @@ -17563,15 +17636,17 @@ <h4 id=the-meter-element><span class=secno>4.6.19 </span>The <dfn><code>meter</c
not specified but the <code title=attr-meter-max><a href=#attr-meter-max>max</a></code>
attribute <em>is</em> specified and the result of processing the
<code>textContent</code> of the element was one number with no
associated denominator punctuation character, then that number is
the actual value.</p>
associated <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>, then that
number is the actual value.</p>

<p>If neither of the <code title=attr-meter-value><a href=#attr-meter-value>value</a></code>
and <code title=attr-meter-max><a href=#attr-meter-max>max</a></code> attributes are
specified, then, if the result of processing the
<code>textContent</code> of the element was one number (with or
without an associated denominator punctuation character), then
that is the actual value, and if the result of processing the
without an associated <a href=#valid-denominator-punctuation-character title="valid denominator punctuation
character">denominator punctuation character</a>), then that is
the actual value, and if the result of processing the
<code>textContent</code> of the element was two numbers, then the
actual value is the lower of the two numbers found.</p>

Expand Down

0 comments on commit 94d4620

Please sign in to comment.