[development] behaviors context

David Cohen drupal at dave-cohen.com
Fri May 29 19:03:37 UTC 2009

So just to clarify, will the context always refer to a single element? 
In other words should my code be:

$elem = $(context).get(0);

or, more like:

$(context).each(function () {
  $elem = $(this).get(0);

And in the first invocation, when context == document, will
$(document).get(0) return the document?

Thanks everyone for helping me understand.


On Fri, 29 May 2009 11:44 -0700, "Earl Miles" <merlin at logrus.com> wrote:
> I totally disagree. It's either a jquery object or something you can 
> easily make into a jquery object. Using $(context) should always work 
> and you can get a DOM element using $(context).get(0). Ignoring context 
> will lead to poor performance.

More information about the development mailing list