Created
November 29, 2010 04:30
-
-
Save heapwolf/719583 to your computer and use it in GitHub Desktop.
identify ES5 functions that are not implemented in a browser (returns an object literal of arrays that contain the names of the missing functions)
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 characters
| var issues = (function() { | |
| var o = { | |
| "Array.prototype": "forEach map reduce reduceRight filter every some indexOf lastIndexOf", | |
| "Array": "isArray", | |
| "Object": "keys preventExtensions isExtensible getOwnPropertyDescriptor defineProperty getOwnPropertyNames create seal isSealed freeze isFrozen" | |
| }; | |
| for(var l in o) { | |
| o[l] = o[l].split(" "); | |
| for(var f=0; f<o[l].length; f++) { | |
| var k = l.split("."); | |
| if(!!(k[1] ? window[k[0]][k[1]] : window[k[0]])[o[l][f]]) { | |
| o[l].splice(f, 1); --f; | |
| } | |
| } | |
| } | |
| return o; | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is not tested with IE. Not sure exactly how dependable it is, i needed it for a pretty narrow edge case. please feel free to mod!!