Browse files

[] (0) WF2: type=date, type=month, type=week

git-svn-id: http://svn.whatwg.org/webapps@2252 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent b40fe61 commit 9bccbfa34c373732b06110f7ae6dae7a7c714af0 @Hixie Hixie committed Sep 30, 2008
Showing with 761 additions and 17 deletions.
  1. +383 −7 index
  2. +378 −10 source
View
390 index
@@ -30254,7 +30254,126 @@ function AddCloud(data, x, y) { ... }</pre>
the <a href="#date3" title=attr-input-type-date>Date</a> state, the rules
in this section apply.
- <p class=big-issue>...
+ <p>The <code><a href="#input0">input</a></code> element represents a
+ control for setting the element's <a href="#value12"
+ title=concept-fe-value>value</a> to a string representing a specific <a
+ href="#date" title=concept-date>date</a>.
+
+ <p>If the element is <i title=concept-input-mutable><a
+ href="#mutable">mutable</a></i>, the user should allow the user to change
+ the <a href="#date" title=concept-date>date</a> represented by its <a
+ href="#value12" title=concept-fe-value>value</a>, as obtained by <a
+ href="#parse2" title="parse a date string">parsing a date</a> from it.
+ User agents must not allow the user to set the <a href="#value12"
+ title=concept-fe-value>value</a> to a string that is not a <a
+ href="#valid8">valid date string</a>. If the user agent provides a user
+ interface for selecting a <a href="#date" title=concept-date>date</a>,
+ then the <a href="#value12" title=concept-fe-value>value</a> must be set
+ to a <a href="#valid8">valid date string</a> representing the user's
+ selection. User agents should allow the user to set the <a href="#value12"
+ title=concept-fe-value>value</a> to the empty string.
+
+ <p><strong>The <a href="#value8">value sanitization algorithm</a> is as
+ follows:</strong> If the <a href="#value12"
+ title=concept-fe-value>value</a> of the element is not a <a
+ href="#valid8">valid date string</a>, then set it to the empty string
+ instead.
+
+ <p>The <code title=attr-input-min><a href="#min2">min</a></code> attribute,
+ if specified, must have a value that is a <a href="#valid8">valid date
+ string</a>. The <code title=attr-input-max><a href="#max4">max</a></code>
+ attribute, if specified, must have a value that is a <a
+ href="#valid8">valid date string</a>.
+
+ <p>The <code title=attr-input-step><a href="#step0">step</a></code>
+ attribute is expressed in days. The <a href="#step-"
+ title=concept-input-step-scale>step scale factor</a> is 86,400,000 (which
+ converts the days to milliseconds, as used in the other algorithms). The
+ <a href="#default2" title=concept-input-step-default>default step</a> is 1
+ day.
+
+ <p>When the element is <a href="#suffering3">suffering from a step
+ mismatch</a>, the user agent may round the element's <span
+ title=concept-input-value>value</span> to the nearest <a href="#date"
+ title=concept-date>date</a> for which the element would not <a
+ href="#suffering3" title="suffering from a step mismatch">suffer from a
+ step mismatch</a>.
+
+ <p><strong>The <a href="#algorithm5"
+ title=concept-input-value-string-number>algorithm to convert a string to a
+ number</a>, given a string <var title="">input</var>, is as
+ follows:</strong> If <a href="#parse2" title="parse a date string">parsing
+ a date</a> from <var title="">input</var> results in an error, then return
+ an error; otherwise, return the number of milliseconds elapsed from
+ midnight UTC on the morning of 1970-01-01 (the time represented by the
+ value "<code title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on
+ the morning of the parsed <a href="#date" title=concept-date>date</a>,
+ ignoring leap seconds.
+
+ <p><strong>The <a href="#algorithm6"
+ title=concept-input-value-number-string>algorithm to convert a number to a
+ string</a>, given a number <var title="">input</var>, is as
+ follows:</strong> Return a <a href="#valid8">valid date string</a> that
+ represents the <a href="#date" title=concept-date>date</a> that, in UTC,
+ is current <var title="">input</var> milliseconds after midnight UTC on
+ the morning of 1970-01-01 (the time represented by the value "<code
+ title="">1970-01-01T00:00:00.0Z</code>").
+
+ <p><strong>The <a href="#algorithm7"
+ title=concept-input-value-string-date>algorithm to convert a string to a
+ <code>Date</code> object</a>, given a string <var title="">input</var>, is
+ as follows:</strong> If <a href="#parse2" title="parse a date
+ string">parsing a date</a> from <var title="">input</var> results in an
+ error, then return an error; otherwise, return a <code>Date</code> object
+ representing midnight UTC on the morning of the parsed <a href="#date"
+ title=concept-date>date</a>.
+
+ <p><strong>The <a href="#algorithm8"
+ title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a <code>Date</code> object
+ <var title="">input</var>, is as follows:</strong> Return a <a
+ href="#valid8">valid date string</a> that represents the <a href="#date"
+ title=concept-date>date</a> current at the time represented by <var
+ title="">input</var> in the UTC timezone.
+
+ <p>The following common <code><a href="#input0">input</a></code> element
+ content attributes, DOM attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a
+ href="#autocomplete0">autocomplete</a></code>, <code
+ title=attr-input-list>list</code>, <code title=attr-input-max><a
+ href="#max4">max</a></code>, <code title=attr-input-min><a
+ href="#min2">min</a></code>, <code title=attr-input-readonly><a
+ href="#readonly0">readonly</a></code>, <code
+ title=attr-input-required>required</code>, and <code
+ title=attr-input-step><a href="#step0">step</a></code> content attributes;
+ <code title=dom-input-list><a href="#list">list</a></code>, <code
+ title=dom-input-valueAsDate><a href="#valueasdate">valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a
+ href="#valueasnumber">valueAsNumber</a></code>, <code
+ title=dom-input-selectedOption><a
+ href="#selectedoption">selectedOption</a></code>, <code
+ title=dom-input-stepUp><a href="#stepup">stepUp()</a></code>, and <code
+ title=dom-input-stepDown><a href="#stepdown">stepDown()</a></code> DOM
+ attributes.
+
+ <p>The following content attributes must not be specified and do not apply
+ to the element: <code class=no-backref title=attr-input-accept><a
+ href="#accept0">accept</a></code>, <code class=no-backref
+ title=attr-input-alt>alt</code>, <code class=no-backref
+ title=attr-input-checked>checked</code>, <code class=no-backref
+ title=attr-input-maxlength><a href="#maxlength0">maxlength</a></code>,
+ <code class=no-backref title=attr-input-pattern>pattern</code>, <code
+ class=no-backref title=attr-input-size>size</code>, <code class=no-backref
+ title=attr-input-src>src</code>, <code class=no-backref
+ title=attr-fs-target><a href="#target3">target</a></code>, <code
+ class=no-backref title=attr-fs-method><a href="#method">method</a></code>,
+ <code class=no-backref title=attr-fs-enctype><a
+ href="#enctype">enctype</a></code>, and <code class=no-backref
+ title=attr-fs-action><a href="#action">action</a></code>.
+
+ <p>The <code class=no-backref title=dom-input-checked><a
+ href="#checked1">checked</a></code> DOM attribute does not apply to the
+ element.
<h6 id=month><span class=secno>4.10.4.1.7. </span><dfn id=month2
title=attr-input-type-month>Month</dfn> state</h6>
@@ -30264,7 +30383,124 @@ function AddCloud(data, x, y) { ... }</pre>
the <a href="#month2" title=attr-input-type-month>Month</a> state, the
rules in this section apply.
- <p class=big-issue>...
+ <p>The <code><a href="#input0">input</a></code> element represents a
+ control for setting the element's <a href="#value12"
+ title=concept-fe-value>value</a> to a string representing a specific <a
+ href="#month0" title=concept-month>month</a>.
+
+ <p>If the element is <i title=concept-input-mutable><a
+ href="#mutable">mutable</a></i>, the user should allow the user to change
+ the <a href="#month0" title=concept-month>month</a> represented by its <a
+ href="#value12" title=concept-fe-value>value</a>, as obtained by <a
+ href="#parse3" title="parse a month string">parsing a month</a> from it.
+ User agents must not allow the user to set the <a href="#value12"
+ title=concept-fe-value>value</a> to a string that is not a <a
+ href="#valid9">valid month string</a>. If the user agent provides a user
+ interface for selecting a <a href="#month0" title=concept-month>month</a>,
+ then the <a href="#value12" title=concept-fe-value>value</a> must be set
+ to a <a href="#valid9">valid month string</a> representing the user's
+ selection. User agents should allow the user to set the <a href="#value12"
+ title=concept-fe-value>value</a> to the empty string.
+
+ <p><strong>The <a href="#value8">value sanitization algorithm</a> is as
+ follows:</strong> If the <a href="#value12"
+ title=concept-fe-value>value</a> of the element is not a <a
+ href="#valid9">valid month string</a>, then set it to the empty string
+ instead.
+
+ <p>The <code title=attr-input-min><a href="#min2">min</a></code> attribute,
+ if specified, must have a value that is a <a href="#valid9">valid month
+ string</a>. The <code title=attr-input-max><a href="#max4">max</a></code>
+ attribute, if specified, must have a value that is a <a
+ href="#valid9">valid month string</a>.
+
+ <p>The <code title=attr-input-step><a href="#step0">step</a></code>
+ attribute is expressed in months. The <a href="#step-"
+ title=concept-input-step-scale>step scale factor</a> is 1 (there is no
+ conversion needed as the algorithms use months). The <a href="#default2"
+ title=concept-input-step-default>default step</a> is 1 month.
+
+ <p>When the element is <a href="#suffering3">suffering from a step
+ mismatch</a>, the user agent may round the element's <span
+ title=concept-input-value>value</span> to the nearest <a href="#month0"
+ title=concept-month>month</a> for which the element would not <a
+ href="#suffering3" title="suffering from a step mismatch">suffer from a
+ step mismatch</a>.
+
+ <p><strong>The <a href="#algorithm5"
+ title=concept-input-value-string-number>algorithm to convert a string to a
+ number</a>, given a string <var title="">input</var>, is as
+ follows:</strong> If <a href="#parse3" title="parse a month
+ string">parsing a month time</a> from <var title="">input</var> results in
+ an error, then return an error; otherwise, return the number of months
+ between January 1970 and the parsed <a href="#month0"
+ title=concept-month>month</a>.
+
+ <p><strong>The <a href="#algorithm6"
+ title=concept-input-value-number-string>algorithm to convert a number to a
+ string</a>, given a number <var title="">input</var>, is as
+ follows:</strong> Return a <a href="#valid9">valid month string</a> that
+ represents the <span title=concept-monthtime>month</span> that has <var
+ title="">input</var> months between it and January 1970.</p>
+ <!-- note - it doesn't matter exactly how many months are "between"
+ two months, so long as the UA implements this consistently. The
+ number is never actually exposed. -->
+
+ <p><strong>The <a href="#algorithm7"
+ title=concept-input-value-string-date>algorithm to convert a string to a
+ <code>Date</code> object</a>, given a string <var title="">input</var>, is
+ as follows:</strong> If <a href="#parse3" title="parse a month
+ string">parsing a month</a> from <var title="">input</var> results in an
+ error, then return an error; otherwise, return a <code>Date</code> object
+ representing midnight UTC on the morning of the first day of the parsed <a
+ href="#month0" title=concept-month>month</a>.
+
+ <p><strong>The <a href="#algorithm8"
+ title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a <code>Date</code> object
+ <var title="">input</var>, is as follows:</strong> Return a <a
+ href="#valid9">valid month string</a> that represents the <a
+ href="#month0" title=concept-month>month</a> current at the time
+ represented by <var title="">input</var> in the UTC timezone.
+
+ <p>The following common <code><a href="#input0">input</a></code> element
+ content attributes, DOM attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a
+ href="#autocomplete0">autocomplete</a></code>, <code
+ title=attr-input-list>list</code>, <code title=attr-input-max><a
+ href="#max4">max</a></code>, <code title=attr-input-min><a
+ href="#min2">min</a></code>, <code title=attr-input-readonly><a
+ href="#readonly0">readonly</a></code>, <code
+ title=attr-input-required>required</code>, and <code
+ title=attr-input-step><a href="#step0">step</a></code> content attributes;
+ <code title=dom-input-list><a href="#list">list</a></code>, <code
+ title=dom-input-valueAsDate><a href="#valueasdate">valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a
+ href="#valueasnumber">valueAsNumber</a></code>, <code
+ title=dom-input-selectedOption><a
+ href="#selectedoption">selectedOption</a></code>, <code
+ title=dom-input-stepUp><a href="#stepup">stepUp()</a></code>, and <code
+ title=dom-input-stepDown><a href="#stepdown">stepDown()</a></code> DOM
+ attributes.
+
+ <p>The following content attributes must not be specified and do not apply
+ to the element: <code class=no-backref title=attr-input-accept><a
+ href="#accept0">accept</a></code>, <code class=no-backref
+ title=attr-input-alt>alt</code>, <code class=no-backref
+ title=attr-input-checked>checked</code>, <code class=no-backref
+ title=attr-input-maxlength><a href="#maxlength0">maxlength</a></code>,
+ <code class=no-backref title=attr-input-pattern>pattern</code>, <code
+ class=no-backref title=attr-input-size>size</code>, <code class=no-backref
+ title=attr-input-src>src</code>, <code class=no-backref
+ title=attr-fs-target><a href="#target3">target</a></code>, <code
+ class=no-backref title=attr-fs-method><a href="#method">method</a></code>,
+ <code class=no-backref title=attr-fs-enctype><a
+ href="#enctype">enctype</a></code>, and <code class=no-backref
+ title=attr-fs-action><a href="#action">action</a></code>.
+
+ <p>The <code class=no-backref title=dom-input-checked><a
+ href="#checked1">checked</a></code> DOM attribute does not apply to the
+ element.
<h6 id=week-state><span class=secno>4.10.4.1.8. </span><dfn id=week1
title=attr-input-type-week>Week</dfn> state</h6>
@@ -30274,7 +30510,126 @@ function AddCloud(data, x, y) { ... }</pre>
the <a href="#week1" title=attr-input-type-week>Week</a> state, the rules
in this section apply.
- <p class=big-issue>...
+ <p>The <code><a href="#input0">input</a></code> element represents a
+ control for setting the element's <a href="#value12"
+ title=concept-fe-value>value</a> to a string representing a specific <a
+ href="#week" title=concept-week>week</a>.
+
+ <p>If the element is <i title=concept-input-mutable><a
+ href="#mutable">mutable</a></i>, the user should allow the user to change
+ the <a href="#week" title=concept-week>week</a> represented by its <a
+ href="#value12" title=concept-fe-value>value</a>, as obtained by <a
+ href="#parse4" title="parse a week string">parsing a week</a> from it.
+ User agents must not allow the user to set the <a href="#value12"
+ title=concept-fe-value>value</a> to a string that is not a <a
+ href="#valid10">valid week string</a>. If the user agent provides a user
+ interface for selecting a <a href="#week" title=concept-week>week</a>,
+ then the <a href="#value12" title=concept-fe-value>value</a> must be set
+ to a <a href="#valid10">valid week string</a> representing the user's
+ selection. User agents should allow the user to set the <a href="#value12"
+ title=concept-fe-value>value</a> to the empty string.
+
+ <p><strong>The <a href="#value8">value sanitization algorithm</a> is as
+ follows:</strong> If the <a href="#value12"
+ title=concept-fe-value>value</a> of the element is not a <a
+ href="#valid10">valid week string</a>, then set it to the empty string
+ instead.
+
+ <p>The <code title=attr-input-min><a href="#min2">min</a></code> attribute,
+ if specified, must have a value that is a <a href="#valid10">valid week
+ string</a>. The <code title=attr-input-max><a href="#max4">max</a></code>
+ attribute, if specified, must have a value that is a <a
+ href="#valid10">valid week string</a>.
+
+ <p>The <code title=attr-input-step><a href="#step0">step</a></code>
+ attribute is expressed in weeks. The <a href="#step-"
+ title=concept-input-step-scale>step scale factor</a> is 604,800,000 (which
+ converts the weeks to milliseconds, as used in the other algorithms). The
+ <a href="#default2" title=concept-input-step-default>default step</a> is 1
+ week.
+
+ <p>When the element is <a href="#suffering3">suffering from a step
+ mismatch</a>, the user agent may round the element's <span
+ title=concept-input-value>value</span> to the nearest <a href="#week"
+ title=concept-week>week</a> for which the element would not <a
+ href="#suffering3" title="suffering from a step mismatch">suffer from a
+ step mismatch</a>.
+
+ <p><strong>The <a href="#algorithm5"
+ title=concept-input-value-string-number>algorithm to convert a string to a
+ number</a>, given a string <var title="">input</var>, is as
+ follows:</strong> If <a href="#parse4" title="parse a week string">parsing
+ a week string</a> from <var title="">input</var> results in an error, then
+ return an error; otherwise, return the number of milliseconds elapsed from
+ midnight UTC on the morning of 1970-01-01 (the time represented by the
+ value "<code title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on
+ the morning of the Monday of the parsed <a href="#week"
+ title=concept-week>week</a>, ignoring leap seconds.
+
+ <p><strong>The <a href="#algorithm6"
+ title=concept-input-value-number-string>algorithm to convert a number to a
+ string</a>, given a number <var title="">input</var>, is as
+ follows:</strong> Return a <a href="#valid10">valid week string</a> that
+ represents the <a href="#week" title=concept-week>week</a> that, in UTC,
+ is current <var title="">input</var> milliseconds after midnight UTC on
+ the morning of 1970-01-01 (the time represented by the value "<code
+ title="">1970-01-01T00:00:00.0Z</code>").
+
+ <p><strong>The <a href="#algorithm7"
+ title=concept-input-value-string-date>algorithm to convert a string to a
+ <code>Date</code> object</a>, given a string <var title="">input</var>, is
+ as follows:</strong> If <a href="#parse4" title="parse a week
+ string">parsing a week</a> from <var title="">input</var> results in an
+ error, then return an error; otherwise, return a <code>Date</code> object
+ representing midnight UTC on the morning of the Monday of the parsed <a
+ href="#week" title=concept-week>week</a>.
+
+ <p><strong>The <a href="#algorithm8"
+ title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a>, given a <code>Date</code> object
+ <var title="">input</var>, is as follows:</strong> Return a <a
+ href="#valid10">valid week string</a> that represents the <a href="#week"
+ title=concept-week>week</a> current at the time represented by <var
+ title="">input</var> in the UTC timezone.
+
+ <p>The following common <code><a href="#input0">input</a></code> element
+ content attributes, DOM attributes, and methods apply to the element:
+ <code title=attr-input-autocomplete><a
+ href="#autocomplete0">autocomplete</a></code>, <code
+ title=attr-input-list>list</code>, <code title=attr-input-max><a
+ href="#max4">max</a></code>, <code title=attr-input-min><a
+ href="#min2">min</a></code>, <code title=attr-input-readonly><a
+ href="#readonly0">readonly</a></code>, <code
+ title=attr-input-required>required</code>, and <code
+ title=attr-input-step><a href="#step0">step</a></code> content attributes;
+ <code title=dom-input-list><a href="#list">list</a></code>, <code
+ title=dom-input-valueAsDate><a href="#valueasdate">valueAsDate</a></code>,
+ <code title=dom-input-valueAsNumber><a
+ href="#valueasnumber">valueAsNumber</a></code>, <code
+ title=dom-input-selectedOption><a
+ href="#selectedoption">selectedOption</a></code>, <code
+ title=dom-input-stepUp><a href="#stepup">stepUp()</a></code>, and <code
+ title=dom-input-stepDown><a href="#stepdown">stepDown()</a></code> DOM
+ attributes.
+
+ <p>The following content attributes must not be specified and do not apply
+ to the element: <code class=no-backref title=attr-input-accept><a
+ href="#accept0">accept</a></code>, <code class=no-backref
+ title=attr-input-alt>alt</code>, <code class=no-backref
+ title=attr-input-checked>checked</code>, <code class=no-backref
+ title=attr-input-maxlength><a href="#maxlength0">maxlength</a></code>,
+ <code class=no-backref title=attr-input-pattern>pattern</code>, <code
+ class=no-backref title=attr-input-size>size</code>, <code class=no-backref
+ title=attr-input-src>src</code>, <code class=no-backref
+ title=attr-fs-target><a href="#target3">target</a></code>, <code
+ class=no-backref title=attr-fs-method><a href="#method">method</a></code>,
+ <code class=no-backref title=attr-fs-enctype><a
+ href="#enctype">enctype</a></code>, and <code class=no-backref
+ title=attr-fs-action><a href="#action">action</a></code>.
+
+ <p>The <code class=no-backref title=dom-input-checked><a
+ href="#checked1">checked</a></code> DOM attribute does not apply to the
+ element.
<h6 id=time-state><span class=secno>4.10.4.1.9. </span><dfn id=time4
title=attr-input-type-time>Time</dfn> state</h6>
@@ -30772,6 +31127,8 @@ rel="" on submit buttons?
<h6 id=the-step><span class=secno>4.10.4.2.5. </span>The <code
title=attr-input-step><a href="#step0">step</a></code> attribute</h6>
+ <!-- XXX this is defined to be a floating point number, which is a
+ little odd for type=date, type=month, and type=week -->
<p>The <dfn id=step0 title=attr-input-step><code>step</code></dfn>
attribute indicates the granularity that is expected (and required) of the
@@ -30890,6 +31247,9 @@ rel="" on submit buttons?
title=concept-fe-value>value</a> of the element to resulting string.
<hr>
+ <!-- XXX should simplify this stuff. The only reason we defer to the
+ Date stuff here is type=month; can we make things simpler somehow?
+ -->
<p>The <dfn id=valueasnumber
title=dom-input-valueAsNumber><code>valueAsNumber</code></dfn> DOM
@@ -30900,8 +31260,17 @@ rel="" on submit buttons?
href="#valueasnumber">valueAsNumber</a></code> attribute does not apply,
as defined for the <code><a href="#input0">input</a></code> element's
<code title=attr-input-type><a href="#type14">type</a></code> attribute's
- current state, then return a Not-a-Number (NaN) value. Otherwise, run the
- <a href="#algorithm5" title=concept-input-value-string-number>algorithm to
+ current state, then return a Not-a-Number (NaN) value. Otherwise, if the
+ <code title=dom-input-valueAsNumber><a
+ href="#valueasnumber">valueAs<em>Date</em></a></code> attribute applies,
+ run the <a href="#algorithm7"
+ title=concept-input-value-string-date>algorithm to convert a string to a
+ <code>Date</code> object</a> defined for that state; if the algorithm
+ returned a <code>Date</code> object, then return the <i>time value</i> of
+ the object (the number of milliseconds from midnight UTC the morning of
+ 1970-01-01 to the time represented by the <code>Date</code> object),
+ otherwise, return a Not-a-Number (NaN) value. Otherwise, run the <a
+ href="#algorithm5" title=concept-input-value-string-number>algorithm to
convert a string to a number</a> defined for that state; if the algorithm
returned a number, then return it, otherwise, return a Not-a-Number (NaN)
value.
@@ -30910,8 +31279,15 @@ rel="" on submit buttons?
href="#valueasnumber">valueAsNumber</a></code> attribute does not apply,
as defined for the <code><a href="#input0">input</a></code> element's
<code title=attr-input-type><a href="#type14">type</a></code> attribute's
- current state, then throw an <code>INVALID_ACCESS_ERR</code> exception;
- otherwise, run the <a href="#algorithm6"
+ current state, then throw an <code>INVALID_ACCESS_ERR</code> exception.
+ Otherwise, if the <code title=dom-input-valueAsNumber><a
+ href="#valueasnumber">valueAs<em>Date</em></a></code> attribute applies,
+ run the <a href="#algorithm8"
+ title=concept-input-value-date-string>algorithm to convert a
+ <code>Date</code> object to a string</a> defined for that state, passing
+ it a <code>Date</code> object whose <i>time value</i> is the new value,
+ and set the <a href="#value12" title=concept-fe-value>value</a> of the
+ element to resulting string. Otherwise, run the <a href="#algorithm6"
title=concept-input-value-number-string>algorithm to convert a number to a
string</a>, as defined for that state, on the new value, and set the <a
href="#value12" title=concept-fe-value>value</a> of the element to
View
388 source
@@ -26726,7 +26726,121 @@ function AddCloud(data, x, y) { ... }</pre>
title="attr-input-type-date">Date</span> state, the rules in this
section apply.</p>
- <p class="big-issue">...</p>
+ <p>The <code>input</code> element represents a control for setting
+ the element's <span title="concept-fe-value">value</span> to a
+ string representing a specific <span
+ title="concept-date">date</span>.</p>
+
+ <p>If the element is <i title="concept-input-mutable">mutable</i>,
+ the user should allow the user to change the <span
+ title="concept-date">date</span> represented by its <span
+ title="concept-fe-value">value</span>, as obtained by <span
+ title="parse a date string">parsing a date</span> from 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 date string</span>. If the user agent provides a user
+ interface for selecting a <span title="concept-date">date</span>,
+ then the <span title="concept-fe-value">value</span> must be set to
+ a <span>valid date string</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><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 date string</span>, then set it
+ to the empty string instead.</p>
+
+ <p>The <code title="attr-input-min">min</code> attribute, if
+ specified, must have a value that is a <span>valid date
+ string</span>. The <code title="attr-input-max">max</code>
+ attribute, if specified, must have a value that is a <span>valid
+ date string</span>.</p>
+
+ <p>The <code title="attr-input-step">step</code> attribute is
+ expressed in days. The <span title="concept-input-step-scale">step
+ scale factor</span> is 86,400,000 (which converts the days to
+ milliseconds, as used in the other algorithms). The <span
+ title="concept-input-step-default">default step</span> is 1 day.</p>
+
+ <p>When the element is <span>suffering from a step mismatch</span>,
+ the user agent may round the element's <span
+ title="concept-input-value">value</span> to the nearest <span
+ title="concept-date">date</span> for which the element would not
+ <span title="suffering from a step mismatch">suffer from a step
+ mismatch</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-string-number">algorithm to convert a
+ string to a number</span>, given a string <var title="">input</var>,
+ is as follows:</strong> If <span title="parse a date string">parsing
+ a date</span> from <var title="">input</var> results in an error,
+ then return an error; otherwise, return the number of milliseconds
+ elapsed from midnight UTC on the morning of 1970-01-01 (the time
+ represented by the value "<code
+ title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on the
+ morning of the parsed <span title="concept-date">date</span>,
+ ignoring leap seconds.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-number-string">algorithm to convert a
+ number to a string</span>, given a number <var title="">input</var>,
+ is as follows:</strong> Return a <span>valid date string</span> that
+ represents the <span title="concept-date">date</span> that, in UTC,
+ is current <var title="">input</var> milliseconds after midnight UTC
+ on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0Z</code>").</p>
+
+ <p><strong>The <span
+ title="concept-input-value-string-date">algorithm to convert a
+ string to a <code>Date</code> object</span>, given a string <var
+ title="">input</var>, is as follows:</strong> If <span title="parse
+ a date string">parsing a date</span> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return a
+ <code>Date</code> object representing midnight UTC on the morning of
+ the parsed <span title="concept-date">date</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-date-string">algorithm to convert a
+ <code>Date</code> object to a string</span>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows:</strong> Return a <span>valid date string</span> that
+ represents the <span title="concept-date">date</span> current at the
+ time represented by <var title="">input</var> in the UTC
+ timezone.</p>
+
+ <p>The following common <code>input</code> element content
+ attributes, DOM attributes, and methods apply to the element:
+ <code title="attr-input-autocomplete">autocomplete</code>,
+ <code title="attr-input-list">list</code>,
+ <code title="attr-input-max">max</code>,
+ <code title="attr-input-min">min</code>,
+ <code title="attr-input-readonly">readonly</code>,
+ <code title="attr-input-required">required</code>, and
+ <code title="attr-input-step">step</code> content attributes;
+ <code title="dom-input-list">list</code>,
+ <code title="dom-input-valueAsDate">valueAsDate</code>,
+ <code title="dom-input-valueAsNumber">valueAsNumber</code>,
+ <code title="dom-input-selectedOption">selectedOption</code>,
+ <code title="dom-input-stepUp">stepUp()</code>, and
+ <code title="dom-input-stepDown">stepDown()</code> DOM attributes.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class="no-backref" title="attr-input-accept">accept</code>,
+ <code class="no-backref" title="attr-input-alt">alt</code>,
+ <code class="no-backref" title="attr-input-checked">checked</code>,
+ <code class="no-backref" title="attr-input-maxlength">maxlength</code>,
+ <code class="no-backref" title="attr-input-pattern">pattern</code>,
+ <code class="no-backref" title="attr-input-size">size</code>,
+ <code class="no-backref" title="attr-input-src">src</code>,
+ <code class="no-backref" title="attr-fs-target">target</code>,
+ <code class="no-backref" title="attr-fs-method">method</code>,
+ <code class="no-backref" title="attr-fs-enctype">enctype</code>, and
+ <code class="no-backref" title="attr-fs-action">action</code>.</p>
+
+ <p>The
+ <code class="no-backref" title="dom-input-checked">checked</code>
+ DOM attribute does not apply to the element.</p>
@@ -26737,7 +26851,123 @@ function AddCloud(data, x, y) { ... }</pre>
title="attr-input-type-month">Month</span> state, the rules in this
section apply.</p>
- <p class="big-issue">...</p>
+ <p>The <code>input</code> element represents a control for setting
+ the element's <span title="concept-fe-value">value</span> to a
+ string representing a specific <span
+ title="concept-month">month</span>.</p>
+
+ <p>If the element is <i title="concept-input-mutable">mutable</i>,
+ the user should allow the user to change the <span
+ title="concept-month">month</span> represented by its <span
+ title="concept-fe-value">value</span>, as obtained by <span
+ title="parse a month string">parsing a month</span> from 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 month string</span>. If the user agent provides a user
+ interface for selecting a <span title="concept-month">month</span>,
+ then the <span title="concept-fe-value">value</span> must be set to
+ a <span>valid month string</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><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 month string</span>, then set it
+ to the empty string instead.</p>
+
+ <p>The <code title="attr-input-min">min</code> attribute, if
+ specified, must have a value that is a <span>valid month
+ string</span>. The <code title="attr-input-max">max</code>
+ attribute, if specified, must have a value that is a <span>valid
+ month string</span>.</p>
+
+ <p>The <code title="attr-input-step">step</code> attribute is
+ expressed in months. The <span title="concept-input-step-scale">step
+ scale factor</span> is 1 (there is no conversion needed as the
+ algorithms use months). The <span
+ title="concept-input-step-default">default step</span> is 1
+ month.</p>
+
+ <p>When the element is <span>suffering from a step mismatch</span>,
+ the user agent may round the element's <span
+ title="concept-input-value">value</span> to the nearest <span
+ title="concept-month">month</span> for which the element would not
+ <span title="suffering from a step mismatch">suffer from a step
+ mismatch</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-string-number">algorithm to convert a
+ string to a number</span>, given a string <var title="">input</var>,
+ is as follows:</strong> If <span title="parse a month
+ string">parsing a month time</span> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return the
+ number of months between January 1970 and the parsed <span
+ title="concept-month">month</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-number-string">algorithm to convert a
+ number to a string</span>, given a number <var title="">input</var>,
+ is as follows:</strong> Return a <span>valid month string</span>
+ that represents the <span title="concept-monthtime">month</span>
+ that has <var title="">input</var> months between it and January
+ 1970.</p>
+
+ <!-- note - it doesn't matter exactly how many months are "between"
+ two months, so long as the UA implements this consistently. The
+ number is never actually exposed. -->
+
+ <p><strong>The <span
+ title="concept-input-value-string-date">algorithm to convert a
+ string to a <code>Date</code> object</span>, given a string <var
+ title="">input</var>, is as follows:</strong> If <span title="parse
+ a month string">parsing a month</span> from <var
+ title="">input</var> results in an error, then return an error;
+ otherwise, return a <code>Date</code> object representing midnight
+ UTC on the morning of the first day of the parsed <span
+ title="concept-month">month</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-date-string">algorithm to convert a
+ <code>Date</code> object to a string</span>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows:</strong> Return a <span>valid month string</span> that
+ represents the <span title="concept-month">month</span> current at
+ the time represented by <var title="">input</var> in the UTC
+ timezone.</p>
+
+ <p>The following common <code>input</code> element content
+ attributes, DOM attributes, and methods apply to the element:
+ <code title="attr-input-autocomplete">autocomplete</code>,
+ <code title="attr-input-list">list</code>,
+ <code title="attr-input-max">max</code>,
+ <code title="attr-input-min">min</code>,
+ <code title="attr-input-readonly">readonly</code>,
+ <code title="attr-input-required">required</code>, and
+ <code title="attr-input-step">step</code> content attributes;
+ <code title="dom-input-list">list</code>,
+ <code title="dom-input-valueAsDate">valueAsDate</code>,
+ <code title="dom-input-valueAsNumber">valueAsNumber</code>,
+ <code title="dom-input-selectedOption">selectedOption</code>,
+ <code title="dom-input-stepUp">stepUp()</code>, and
+ <code title="dom-input-stepDown">stepDown()</code> DOM attributes.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class="no-backref" title="attr-input-accept">accept</code>,
+ <code class="no-backref" title="attr-input-alt">alt</code>,
+ <code class="no-backref" title="attr-input-checked">checked</code>,
+ <code class="no-backref" title="attr-input-maxlength">maxlength</code>,
+ <code class="no-backref" title="attr-input-pattern">pattern</code>,
+ <code class="no-backref" title="attr-input-size">size</code>,
+ <code class="no-backref" title="attr-input-src">src</code>,
+ <code class="no-backref" title="attr-fs-target">target</code>,
+ <code class="no-backref" title="attr-fs-method">method</code>,
+ <code class="no-backref" title="attr-fs-enctype">enctype</code>, and
+ <code class="no-backref" title="attr-fs-action">action</code>.</p>
+
+ <p>The
+ <code class="no-backref" title="dom-input-checked">checked</code>
+ DOM attribute does not apply to the element.</p>
@@ -26748,7 +26978,122 @@ function AddCloud(data, x, y) { ... }</pre>
title="attr-input-type-week">Week</span> state, the rules in this
section apply.</p>
- <p class="big-issue">...</p>
+ <p>The <code>input</code> element represents a control for setting
+ the element's <span title="concept-fe-value">value</span> to a
+ string representing a specific <span
+ title="concept-week">week</span>.</p>
+
+ <p>If the element is <i title="concept-input-mutable">mutable</i>,
+ the user should allow the user to change the <span
+ title="concept-week">week</span> represented by its <span
+ title="concept-fe-value">value</span>, as obtained by <span
+ title="parse a week string">parsing a week</span> from 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 week string</span>. If the user agent provides a user
+ interface for selecting a <span title="concept-week">week</span>,
+ then the <span title="concept-fe-value">value</span> must be set to
+ a <span>valid week string</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><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 week string</span>, then set it
+ to the empty string instead.</p>
+
+ <p>The <code title="attr-input-min">min</code> attribute, if
+ specified, must have a value that is a <span>valid week
+ string</span>. The <code title="attr-input-max">max</code>
+ attribute, if specified, must have a value that is a <span>valid
+ week string</span>.</p>
+
+ <p>The <code title="attr-input-step">step</code> attribute is
+ expressed in weeks. The <span title="concept-input-step-scale">step
+ scale factor</span> is 604,800,000 (which converts the weeks to
+ milliseconds, as used in the other algorithms). The <span
+ title="concept-input-step-default">default step</span> is 1
+ week.</p>
+
+ <p>When the element is <span>suffering from a step mismatch</span>,
+ the user agent may round the element's <span
+ title="concept-input-value">value</span> to the nearest <span
+ title="concept-week">week</span> for which the element would not
+ <span title="suffering from a step mismatch">suffer from a step
+ mismatch</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-string-number">algorithm to convert a
+ string to a number</span>, given a string <var title="">input</var>,
+ is as follows:</strong> If <span title="parse a week string">parsing
+ a week string</span> from <var title="">input</var> results in an
+ error, then return an error; otherwise, return the number of
+ milliseconds elapsed from midnight UTC on the morning of 1970-01-01
+ (the time represented by the value "<code
+ title="">1970-01-01T00:00:00.0Z</code>") to midnight UTC on the
+ morning of the Monday of the parsed <span
+ title="concept-week">week</span>, ignoring leap seconds.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-number-string">algorithm to convert a
+ number to a string</span>, given a number <var title="">input</var>,
+ is as follows:</strong> Return a <span>valid week string</span> that
+ represents the <span title="concept-week">week</span> that, in UTC,
+ is current <var title="">input</var> milliseconds after midnight UTC
+ on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0Z</code>").</p>
+
+ <p><strong>The <span
+ title="concept-input-value-string-date">algorithm to convert a
+ string to a <code>Date</code> object</span>, given a string <var
+ title="">input</var>, is as follows:</strong> If <span title="parse
+ a week string">parsing a week</span> from <var title="">input</var>
+ results in an error, then return an error; otherwise, return a
+ <code>Date</code> object representing midnight UTC on the morning of
+ the Monday of the parsed <span title="concept-week">week</span>.</p>
+
+ <p><strong>The <span
+ title="concept-input-value-date-string">algorithm to convert a
+ <code>Date</code> object to a string</span>, given a
+ <code>Date</code> object <var title="">input</var>, is as
+ follows:</strong> Return a <span>valid week string</span> that
+ represents the <span title="concept-week">week</span> current at the
+ time represented by <var title="">input</var> in the UTC
+ timezone.</p>
+
+ <p>The following common <code>input</code> element content
+ attributes, DOM attributes, and methods apply to the element:
+ <code title="attr-input-autocomplete">autocomplete</code>,
+ <code title="attr-input-list">list</code>,
+ <code title="attr-input-max">max</code>,
+ <code title="attr-input-min">min</code>,
+ <code title="attr-input-readonly">readonly</code>,
+ <code title="attr-input-required">required</code>, and
+ <code title="attr-input-step">step</code> content attributes;
+ <code title="dom-input-list">list</code>,
+ <code title="dom-input-valueAsDate">valueAsDate</code>,
+ <code title="dom-input-valueAsNumber">valueAsNumber</code>,
+ <code title="dom-input-selectedOption">selectedOption</code>,
+ <code title="dom-input-stepUp">stepUp()</code>, and
+ <code title="dom-input-stepDown">stepDown()</code> DOM attributes.</p>
+
+ <p>The following content attributes must not be specified and do not
+ apply to the element:
+ <code class="no-backref" title="attr-input-accept">accept</code>,
+ <code class="no-backref" title="attr-input-alt">alt</code>,
+ <code class="no-backref" title="attr-input-checked">checked</code>,
+ <code class="no-backref" title="attr-input-maxlength">maxlength</code>,
+ <code class="no-backref" title="attr-input-pattern">pattern</code>,
+ <code class="no-backref" title="attr-input-size">size</code>,
+ <code class="no-backref" title="attr-input-src">src</code>,
+ <code class="no-backref" title="attr-fs-target">target</code>,
+ <code class="no-backref" title="attr-fs-method">method</code>,
+ <code class="no-backref" title="attr-fs-enctype">enctype</code>, and
+ <code class="no-backref" title="attr-fs-action">action</code>.</p>
+
+ <p>The
+ <code class="no-backref" title="dom-input-checked">checked</code>
+ DOM attribute does not apply to the element.</p>
@@ -27255,6 +27600,9 @@ rel="" on submit buttons?
<h6>The <code title="attr-input-step">step</code> attribute</h6>
+ <!-- XXX this is defined to be a floating point number, which is a
+ little odd for type=date, type=month, and type=week -->
+
<p>The <dfn title="attr-input-step"><code>step</code></dfn>
attribute indicates the granularity that is expected (and required)
of the <span title="concept-fe-value">value</span>, by limiting
@@ -27379,6 +27727,10 @@ rel="" on submit buttons?
<hr>
+ <!-- XXX should simplify this stuff. The only reason we defer to the
+ Date stuff here is type=month; can we make things simpler somehow?
+ -->
+
<p>The <dfn
title="dom-input-valueAsNumber"><code>valueAsNumber</code></dfn> DOM
attribute represents the <span title="concept-fe-value">value</span>
@@ -27388,7 +27740,16 @@ rel="" on submit buttons?
title="dom-input-valueAsNumber">valueAsNumber</code> attribute does
not apply, as defined for the <code>input</code> element's <code
title="attr-input-type">type</code> attribute's current state, then
- return a Not-a-Number (NaN) value. Otherwise, run the <span
+ return a Not-a-Number (NaN) value. Otherwise, if the <code
+ title="dom-input-valueAsNumber">valueAs<em>Date</em></code>
+ attribute applies, run the <span
+ title="concept-input-value-string-date">algorithm to convert a
+ string to a <code>Date</code> object</span> defined for that state;
+ if the algorithm returned a <code>Date</code> object, then return
+ the <i>time value</i> of the object (the number of milliseconds from
+ midnight UTC the morning of 1970-01-01 to the time represented by
+ the <code>Date</code> object), otherwise, return a Not-a-Number
+ (NaN) value. Otherwise, run the <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span> defined for that state; if the algorithm
returned a number, then return it, otherwise, return a Not-a-Number
@@ -27398,12 +27759,19 @@ rel="" on submit buttons?
title="dom-input-valueAsNumber">valueAsNumber</code> attribute does
not apply, as defined for the <code>input</code> element's <code
title="attr-input-type">type</code> attribute's current state, then
- throw an <code>INVALID_ACCESS_ERR</code> exception; otherwise, run
- the <span title="concept-input-value-number-string">algorithm to
- convert a number to a string</span>, as defined for that state, on
- the new value, and set the <span
- title="concept-fe-value">value</span> of the element to resulting
- string.</p>
+ throw an <code>INVALID_ACCESS_ERR</code> exception. Otherwise, if
+ the <code
+ title="dom-input-valueAsNumber">valueAs<em>Date</em></code>
+ attribute applies, run the <span
+ title="concept-input-value-date-string">algorithm to convert a
+ <code>Date</code> object to a string</span> defined for that state,
+ passing it a <code>Date</code> object whose <i>time value</i> is the
+ new value, and set the <span title="concept-fe-value">value</span>
+ of the element to resulting string. Otherwise, run the <span
+ title="concept-input-value-number-string">algorithm to convert a
+ number to a string</span>, as defined for that state, on the new
+ value, and set the <span title="concept-fe-value">value</span> of
+ the element to resulting string.</p>
<hr>

0 comments on commit 9bccbfa

Please sign in to comment.