Skip to content

Instantly share code, notes, and snippets.

@fabiomcosta
Created September 20, 2009 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiomcosta/189834 to your computer and use it in GitHub Desktop.
Save fabiomcosta/189834 to your computer and use it in GitHub Desktop.
var old = Array.from;
try {
old(document.html.childNodes);
} catch(e){
Array.from = function(item, slice){
if (typeOf(item) == 'collection'){
var l = item.length, array = new Array(l - slice), i = slice - 1;
while (++i < l) array[i] = item[i];
return array;
}
return old(item, slice);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment