[whatwg] HTMLInputElement::valueAsNumber and NaN Infinity
TAMURA, Kent
tkent at chromium.org
Mon Jan 25 01:55:25 PST 2010
On setting, if the
valueAsNumber<http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#dom-input-valueasnumber>
attribute
> does not apply, as defined for the
> input<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element>
> element's
> type<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#attr-input-type>
> attribute's
> current state, then throw
> anINVALID_STATE_ERR<http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#invalid_state_err>
> exception.
> Otherwise, if the
> valueAsDate<http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#dom-input-valueasdate>
> attribute
> applies, run the algorithm to convert a Date object to a
> string<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#concept-input-value-date-string>
> defined
> for that state, passing it a Date object whose time value is the new
> value, and set the
> value<http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#concept-fe-value>
> of
> the element to resulting string. Otherwise, run the algorithm to convert a
> number to a
> string<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#concept-input-value-number-string>,
> as defined for that state, on the new value, and set the
> value<http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#concept-fe-value>
> of
> the element to resulting string.
It seems the current spec doesn't define behavior in a case of setting NaN
or Infinitiy to HTMLInputElement::valueAsNumber.
Because 'input.valueAsDate = null' makes the value empty, I think
'input.valueAsNumber = Number.NaN' also makes the value empty.
--
TAMURA Kent
Software Engineer, Google
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100125/ee3c401d/attachment-0002.htm>
More information about the whatwg
mailing list