Created
October 29, 2012 02:54
-
-
Save fredyang/3971215 to your computer and use it in GitHub Desktop.
subclass array
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
//http://dean.edwards.name/weblog/2006/11/hooray/ | |
// create an <iframe> | |
var iframe = document.createElement("iframe"); | |
iframe.style.display = "none"; | |
document.body.appendChild(iframe); | |
// write a script into the <iframe> and steal its Array object | |
frames[frames.length - 1].document.write( | |
"<script>parent.Array2 = Array;<\/script>" | |
); | |
alert(Array2 == Array); // => false | |
Array2.prototype.each = function(iterator) { | |
// iterate | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment