Uh, thanks, you flatter me, but I'm not one of the people that edit the
wiki. I think it would be sweet if the web team got in touch with Simon and
asked him if we could pull that article into docs.jquery.com as an official
jQuery Primer. I think it focuses on the right introductory aspects of
jQuery better than the official documentation.

--Erik


On 8/15/07, pd <[EMAIL PROTECTED]> wrote:
>
>
> Thanks Eric
>
> I'll remember to consider jQuery selector results an array from now
> on.
>
> So, do you feel like updating the wiki? Sounds like you would be the
> best person to do so as your understanding appears quite deep.
>
> I had a look at Mr Willison's article yesterday but only got half way
> through before getting distracted. Bizarre that it apparently has
> something related to this topic? I will have to read the whole thing,
> it's still open in one of my tabs for when I get the time :)
>
> pd
>
> On Aug 16, 11:27 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> > > id is supposed to be unique is it not? My example used the # to refer
> > > to a unique id on the page, therefore *not* an array of objects.
> >
> > Wrong, it *is* still an array of objects, it's just an array of length
> > 1. Do console.log($('#foo')) and you'll see that it is still an array,
> > and an array with one object in it is not the same as the object
> > itself.
> >
> > > AFAIK all three examples get an element on the page as a *single* (not
> > > an array) object.
> >
> > And that's wrong. The jQuery object is always an array. It's of length
> > 0 for no matches, 1 for a single match, or more for multiple matches.
> > That's by design, so that the chaining things work consistently. This
> > allows you to make chained calls that won't throw an error, regardless
> > of whether or not the selector found anything.
> >
> > > I think it's reasonable (though perhaps not programmatically correct)
> > > to see $('#foo') as the equivalent of document.getElementById('foo').
> > > If this is not true in jQuery, which it does not appear to be, all I
> >
> > Right, it's not.
> >
> > > am saying is this distinction should be clearly documented.
> >
> > Agreed. This should probably be made clearer. I think the recently
> > discussed post by Simon Willison addresses this really well (under
> > "Doing stuff with them"):http://simonwillison.net/2007/Aug/15/jquery/
> >
> > --Erik
>
>

Reply via email to