Closed GabiAxel closed 9 years ago
The value
attribute of an HTMLInputElement is always a string: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
Since core-input extends <input>
, Polymer can't intercept calls to value
(as said by @azakus) to return something other than a string. And since this extends a native element, it seems undesirable to change the native interface even if it were possible.
Aha, you can simply use the native valueAsNumber
attribute of HTMLInputElement. If the type
is set to number
, that attribute will return a number:
> var el = document.createElement("input");
> el.type = "number";
> el.value = "1234";
> el.value
"1234"
> el.valueAsNumber
1234
It would be nice if the component parsed and converted the value and inputValue properties to numbers for type="number".