title: QuerySelectorAll is undefined when passed as a variable into an array
body: <p>I'm trying to write the <code>setwidth()</code> function to resize all elements in a given variable (time/city/event) to the width of the broadest element in the set. However the function throws an undefined on the line:</p>
  
  <pre><code>selectorWidth = selectorArray[0].offsetWidth;
  </code></pre>
  
  <p>Any idea how to fix this code?</p>
  
  <pre><code>var time = document.querySelectorAll('.eventinstance &gt; time'),
          city = document.querySelectorAll('.eventinstance &gt; .location'),
          event = document.querySelectorAll('.eventname');
  
      function setwidth(selector) {
          var selectorArray = [];
              for (var i = 0; i &lt; selector.length; i++) {
                  selectorArray.push(selector[i]);
              }
          var maxWidth = 0,
              selectorWidth = selectorArray[0].offsetWidth;
          maxWidth = selectorWidth;
          for (var i = 1; i &lt; selector.length; i++) {
              maxWidth = Math.max(maxWidth, selectorArray[i].offsetWidth);
          }
          for (var i = 0; i &lt; selector.length; i++) {
              selector[i].setAttribute("style", "width:"+maxWidth+"px");
          }
      }
  
  
      function addLoadEvent(func,what) {
          var oldonload = window.onload;
          if (typeof window.onload != 'function') {
              window.onload = func;
          } else {
              window.onload = function () {
                  if (oldonload) {
                      oldonload();
                  }
                  func(what);
              }
          }
      }
      addLoadEvent(setwidth,time);
      addLoadEvent(setwidth,city);
      addLoadEvent(setwidth,event);
  </code></pre>