SHARE
TWEET

Untitled

a guest Jan 12th, 2017 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.getElementsByAttribute =
  2.   Element.prototype.getElementsByAttribute = (attr, value) => {
  3.     const nodeList = document.getElementsByTagName('*'),
  4.           matchedNodes = []
  5.  
  6.     for(let node of nodeList) {
  7.       if(node.hasAttribute(attr) && node.getAttribute(attr) === value)
  8.         matchedNodes.push(node)
  9.     }
  10.    
  11.     return matchedNodes
  12.   }
RAW Paste Data
Top