> ok( jQuery([]).add( document.getElementById('form') ).length >= 13, "Add
> a form (adds the elements)" );
> I'm not able to grep why a form element is treated specially with add, or
> where in the source the single element returned from document.getElementById
> becomes more than a dozen.
In the DOM, a form element has a .length property and can be indexed
(behavior inherited from its .elements collection). The .add() method
calls the internal .clean() method, which sees this .length property
and then adds all the elements in the "collection".
That doesn't seem like *correct* behavior IMO; jQuery
(document.getElementById('form')) returns just the form element by
virtue of the "Handle $(DOMElement)" case at the top of the .init()
method. I would expect $(domElement) == $([]).add(domElement) in all
cases and I don't think it's documented otherwise.
Ah, I found an old thread that may explain how it got this way:
http://www.mail-archive.com/discuss@jquery.com/msg06542.html