Created
August 4, 2014 15:48
-
-
Save jonathansampson/c9071cc90e0014f4859f to your computer and use it in GitHub Desktop.
Revisions
-
jonathansampson renamed this gist
Aug 4, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jonathansampson created this gist
Aug 4, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ (function () { /* Internet Explorer 11 may have trouble retrieving the number type of an input value. This short script performs a quick test, and repairs the functionality if necessary. Load before attempting to use the `valueAsNumber` property on input elements. */ "use strict"; var a = document.createElement( "input" ); a.setAttribute( "type", "number" ); a.setAttribute( "value", 2319 ); if ( "valueAsNumber" in a && a.value != a.valueAsNumber ) { if ( "defineProperty" in Object && "getPrototypeOf" in Object ) { Object.defineProperty( Object.getPrototypeOf( a ), "valueAsNumber", { get: function () { return parseInt( this.value, 10 ); } }); } } }());