Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 Input type=Number Polyfill not working in IE10

I've attempted to use this pollyfill: https://github.com/jonstipe/number-polyfill

But it does nothing in IE10. No script errors either. Is there anything to this besides including the JS and CSS file?

I'll go one step further and point out that the official demo for the polyfill doesn't even work in IE10 on Windows 8: http://jonstipe.github.io/number-polyfill/demo.html

like image 906
brushleaf Avatar asked Apr 18 '13 14:04

brushleaf


1 Answers

The problem is evident from the start:

i = document.createElement("input");
i.setAttribute("type", "number");
if (i.type === "text")

The result of i.type in Internet Explorer 10 is "number," meaning Internet Explorer 10 actually supports the number input type — this is further confirmed by consulting their documentation. You can even confirm that the functionality is in place by trying to put letters into a number input — they'll be removed when the element loses focus.

If you want this tool to progressively enhance the interface for this control in Internet Explorer, you will need to make make the condition resolve to true.

like image 189
Sampson Avatar answered Oct 16 '22 04:10

Sampson