title: IE7: How do I create a real NodeList?
body: <p>I'm trying to make my current project IE7-compatible. We are not using jQuery, but instead using <code>querySelectorAll</code> for our selector needs. However, IE7 doesn't support <code>querySelectorAll</code>, so I've monkey-patched it with code from <a href="https://gist.github.com/868532" rel="nofollow">https://gist.github.com/868532</a>. It actually works fine, except for one small difference: instead of a <code>NodeList</code> like the original <code>querySelectorAll</code>, it returns an array. Since I'd like to stay as compatible as possible, I wanted to make that function return a <code>NodeList</code>. Using some method found on the net, I've adapted the gist to this:</p>
  
  <pre><code>(function(d) {
       d=document, a = d.styleSheets[0] || d.createStyleSheet();
  
       if (! vxJS.isHostMethod(d, 'querySelectorAll')) {
           d.querySelectorAll = function(e) {
               a.addRule(e,'f:b');
  
               for (var l=d.all, b=0, c=d.createDocumentFragment(),f=l.length; b&lt;f; b++) {
                    l[b] &amp;&amp; l[b].currentStyle.f &amp;&amp; c.appendChild(l[b].cloneNode(true));
               }
               a.removeRule(a.rules.length - 1);
               return c.childNodes;
           };
       }
   })();
  </code></pre>
  
  <p>My problem with this code is that <code>appendChild</code> removes a node from its original location in DOM tree, therefore I tried creating a clone with <code>cloneNode</code>, which obviously creates valid node clones, which are not the original nodes and thus cannot be used in further code.</p>
  
  <p>Is there any way I can put a real node reference into a NodeList?</p>