How does jQuery invoke methods of objects when an Array of jQuery objects is returned?
<p>After passing a string "selector" into the jQuery function:</p>

<pre><code>$('#onenode')
</code></pre>

<p>An array of jQuery object's is returned.</p>

<p>One of the methods of these object's is "html", which is why:</p>

<pre><code>$('#onenode').html('hello!');
</code></pre>

<p>Works.</p>

<p>However...</p>

<p>This:</p>

<pre><code>$('.somenodes')
</code></pre>

<p>Returns an array of jQuery objects, each of the objects in this array has the method "html".</p>

<p>So how does:</p>

<pre><code>$('.somenodes').html('hello');
</code></pre>

<p>Work? The "html" method must be a method of the Array Object that is returned.</p>

<p>I assume therefore that the "html" method of the Array Object looks similar to this:</p>

<pre><code>html: function(value) {
   for(var i=0; i&lt;this.length; i+=1) {
      this[i].html(value);
   }
}
</code></pre>

<p>These are all assumptions, I'm pretty much guessing.</p>

<p><strong>I am attempting to create my own small library that uses "selectors", but I am struggling with this part. I know that this is probably incorrect -- could someone explain how jQuery really does it?</strong></p>
