Skip to content

Instantly share code, notes, and snippets.

@ralt
Created November 12, 2012 20:42
Show Gist options
  • Select an option

  • Save ralt/4061749 to your computer and use it in GitHub Desktop.

Select an option

Save ralt/4061749 to your computer and use it in GitHub Desktop.

Revisions

  1. ralt renamed this gist Nov 12, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ralt created this gist Nov 12, 2012.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    NodeList.prototype.forEach = HTMLCollection.prototype.forEach = Array.prototype.forEach;
    NodeList.prototype.map = HTMLCollection.prototype.map = Array.prototype.map;
    NodeList.prototype.filter = HTMLCollection.prototype.filter = Array.prototype.filter;
    NodeList.prototype.reduce = HTMLCollection.prototype.reduce = Array.prototype.reduce;
    NodeList.prototype.every = HTMLCollection.prototype.every = Array.prototype.every;
    NodeList.prototype.some = HTMLCollection.prototype.some = Array.prototype.some;
    var By = {
    id: function (id) { return document.getElementById(id) },
    tag: function (tag, context) {
    return (context || document).getElementsByTagName(tag)
    },
    "class": function (klass, context) {
    return (context || document).getElementsByClassName(klass)
    },
    name: function (name) { return document.getElementsByName(name) },
    qsa: function (query, context) {
    return (context || document).querySelectorAll(query)
    },
    qs: function (query, context) {
    return (context || document).querySelector(query)
    }
    }