title: How to write a function like `document.getElementsWithAttributeName("attr-name")`?
body: <p>Could someone tell me how to write a function: <code>getElementsWithAttributeName("attr-name")</code>?</p>
  
  <p>It should return all elements from the current <code>document</code> that contain the attribute <code>attr-name</code>.</p>
  
  <p>Also, how do I add this function to the document as well?</p>
  
  <p>Any response will be much appreciated.</p>