HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2731Floats: Allow '1e+0' syntax. Require it for serialising floating point numbers. Other editorial fixes.2009-02-01 08:31
@@ -1345,42 +1345,53 @@
 
    </li>
 
    <li>Optionally:
 
     <ol>
 
      <li>Either a U+0065 LATIN SMALL LETTER E character or a U+0045
      LATIN CAPITAL LETTER E character.</li>
 
-     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character.</li>
+     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character or U+002B
+     PLUS SIGN ("+") character.</li>
 
      <li>A series of characters in the range U+0030 DIGIT ZERO (0) to
      U+0039 DIGIT NINE (9).</li>
 
     </ol>
 
    </li>
 
   </ol>
 
   <p>A <span>valid floating point number</span> represents the number
   obtained by multiplying the significand by ten raised to the power
   of the exponent, where the significand is the first number,
   interpreted as base ten (including the decimal point and the number
   after the decimal point, if any, and interpreting the significand as
   a negative number if the whole string starts with a U+002D
   HYPHEN-MINUS ("-") character and the number is not zero), and where
   the exponent is the number after the E, if any (interpreted as a
   negative number if there is a U+002D HYPHEN-MINUS ("-") character
-  between the E and the number and the number is not zero). If there
-  is no E, then the exponent is treated as zero.</p>
+  between the E and the number and the number is not zero, or else
+  ignoring a U+002B PLUS SIGN ("+") character between the E and the
+  number if there is one). If there is no E, then the exponent is
+  treated as zero.</p>
+
+  <p class="note">The values &plusmn;Infinity and NaN are not <span
+  title="valid floating point number">valid floating point
+  numbers</span>.</p>
+
+  <p>The <dfn>best representation of the floating point number</dfn>
+  <var title="">n</var> is the string obtained from applying the
+  ECMAScript operator ToString to <var title="">n</var>.</p>
 
   <p>The <dfn>rules for parsing floating point number values</dfn> are
   as given in the following algorithm. As with the previous
   algorithms, when this one is invoked, the steps must be followed in
   the order given, aborting at the first step that returns
   something. This algorithm will either return a number or an
   error. Leading spaces are ignored. Trailing spaces and garbage
   characters are ignored.</p>
 
   <ol>
@@ -1497,20 +1508,35 @@
 
        <li>Advance <var title="">position</var> to the next
        character.</li>
 
        <li><p>If <var title="">position</var> is past the end of <var
        title="">input</var>, then return <var
        title="">value</var>.</li>
 
       </ol>
 
+      <p>Otherwise, if the character indicated by <var
+      title="">position</var> is a U+002B PLUS SIGN ("+")
+      character:</p>
+
+      <ol>
+
+       <li>Advance <var title="">position</var> to the next
+       character.</li>
+
+       <li><p>If <var title="">position</var> is past the end of <var
+       title="">input</var>, then return <var
+       title="">value</var>.</li>
+
+      </ol>
+
      </li>
 
      <li><p>If the character indicated by <var title="">position</var>
      is not one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9),
      then return <var title="">value</var>.</li>
 
      <li><p><span>Collect a sequence of characters</span> in the range
      U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
      resulting sequence as a base-ten integer. Multiply <var
      title="">exponent</var> by that integer.</p></li>
@@ -3575,21 +3601,21 @@
    <li>
 
     <p>If the algorithm was invoked with an <span>absolute URL</span>
     to use as the base URL, let <var title="">base</var> be that
     <span>absolute URL</span>.</p>
 
     <p>Otherwise, let <var title="">base</var> be the <i>base URI of
     the element</i>, as defined by the XML Base specification, with
     <i>the base URI of the document entity</i> being defined as the
     <span>document base URL</span> of the <code>Document</code> that
-    owns the element.</p>
+    owns the element. <a href="#refsXMLBASE">[XMLBASE]</a></p>
 
     <p>For the purposes of the XML Base specification, user agents
     must act as if all <code>Document</code> objects represented XML
     documents.</p>
 
     <p class="note">It is possible for <code
     title="attr-xml-base">xml:base</code> attributes to be present
     even in HTML fragments, as such attributes can be added
     dynamically using script. (Such scripts would not be conforming,
     however, as <code title="attr-xml-base">xml:base</code> attributes
@@ -5049,24 +5075,27 @@
 
   <p>If a reflecting DOM attribute is a floating point number type
   (<code>float</code>) and it doesn't fall into one of the earlier
   categories, then, on getting, the content attribute must be parsed
   according to the <span>rules for parsing floating point number
   values</span>, and if that is successful, and the value is in the
   range of the DOM attribute's type, the resulting value must be
   returned. If, on the other hand, it fails or returns an out of range
   value, or if the attribute is absent, the default value must be
   returned instead, or 0.0 if there is no default value. On setting,
-  the given value must be converted to the shortest possible string
-  representing the number as a <span>valid floating point
-  number</span> in base ten and then that string must be used as the
-  new content attribute value.</p>
+  the given value must be converted to the <span>best representation
+  of the floating point number</span> and then that string must be
+  used as the new content attribute value.</p>
+
+  <p class="note">The values &plusmn;Infinity and NaN throw an
+  exception on setting, as defined by WebIDL. <a
+  href="#refsWEBIDL">[WEBIDL]</a></p>
 
   <p>If a reflecting DOM attribute is of the type
   <code>DOMTokenList</code>, then on getting it must return a
   <code>DOMTokenList</code> object whose underlying string is the
   element's corresponding content attribute. When the
   <code>DOMTokenList</code> object mutates its underlying string, the
   content attribute must itself be immediately mutated. When the
   attribute is absent, then the string represented by the
   <code>DOMTokenList</code> object is the empty string; when the
   object mutates this empty string, the user agent must first add the
@@ -29434,23 +29463,23 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
   string representing a number.</p>
 
   <p>If the element is <i title="concept-input-mutable">mutable</i>,
   the user agent should allow the user to change the number
   represented by its <span title="concept-fe-value">value</span>, as
   obtained from applying the <span>rules for parsing floating point
   number values</span> to it. User agents must not allow the user to
   set the <span title="concept-fe-value">value</span> to a string that
   is not a <span>valid floating point number</span>. If the user agent
   provides a user interface for selecting a number, then the <span
-  title="concept-fe-value">value</span> must be set to a <span>valid
-  floating point number</span> representing the user's selection. User
-  agents should allow the user to set the <span
+  title="concept-fe-value">value</span> must be set to the <span>best
+  representation of the floating point number</span> representing the
+  user's selection. User agents should allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string.</p>
 
   <p>The <code title="attr-input-value">value</code> attribute, if
   specified, must have a value that is a <span>valid floating point
   number</span>.</p> <!-- ok to set out-of-range value, we never know
   when we might have to represent bogus input -->
 
   <p><strong>The <span>value sanitization algorithm</span> is as
   follows:</strong> If the <span title="concept-fe-value">value</span>
   of the element is not a <span>valid floating point number</span>,
@@ -29558,24 +29587,24 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
   value to the empty string.</p>
 
   <p>If the element is <i title="concept-input-mutable">mutable</i>,
   the user agent should allow the user to change the number
   represented by its <span title="concept-fe-value">value</span>, as
   obtained from applying the <span>rules for parsing floating point
   number values</span> to it. User agents must not allow the user to
   set the <span title="concept-fe-value">value</span> to a string that
   is not a <span>valid floating point number</span>. If the user agent
   provides a user interface for selecting a number, then the <span
-  title="concept-fe-value">value</span> must be set to a <span>valid
-  floating point number</span> representing the user's selection. User
-  agents must not allow the user to set the <span
-  title="concept-fe-value">value</span> to the empty string.</p>
+  title="concept-fe-value">value</span> must be set to a <span>best
+  representation of the floating point number</span> representing the
+  user's selection. User agents must not allow the user to set the
+  <span title="concept-fe-value">value</span> to the empty string.</p>
 
   <p>The <code title="attr-input-value">value</code> attribute, if
   specified, must have a value that is a <span>valid floating point
   number</span>.</p> <!-- ok to set out-of-range value, we never know
   when we might have to represent bogus input -->
 
   <p><strong>The <span>value sanitization algorithm</span> is as
   follows:</strong> If the <span title="concept-fe-value">value</span>
   of the element is not a <span>valid floating point number</span>,
   then set it to a <span>valid floating point number</span> that

|