title: JavaScript IE8: Add a function to a NodeList object
body: <p>I have a reference to a NodeList, and I simply want to attach a function to the object for later invoking by another area of the script.</p>
  
  <pre><code>// Quick and dirty hack to obtain a NodeList from given element(s):
  var fragment = document.createDocumentFragment(),
      nodeList;
  fragment.appendChild(document.getElementById("test").cloneNode(true));
  
  nodeList = fragment.childNodes;
  console.log(nodeList);
  
  // How can a method be defined on the nodeList in IE8?
  nodeList["someMethod"] = function() { alert("YOU WIN!"); };
  nodeList.someMethod();
  </code></pre>
  
  <p>Live example: <a href="http://jsfiddle.net/gCwAr/" rel="nofollow">http://jsfiddle.net/gCwAr/</a></p>
  
  <p>The above code works in these browsers: IE9, Chrome, Firefox, Safari, Opera.</p>
  
  <p>My question is <strong>how to get the code working in IE8</strong>, as the following error is thrown on the penultimate line: </p>
  
  <blockquote>
    <p>Object doesn't support this property or method</p>
  </blockquote>