Re: how to add elements to a jQuery object without copying it
thanx a lot, i think i’ve got it.
actually, the first part of your answer does not work for me---with
`add`, a new collection is returned. this breaks object identity
(hence, you cannot keep a reference from another variable to the
jQuery object in question once you've done `add`).
the second suggestion does work; however, the pre-incrementing index
has to be written as a post-incrementing index, like this:
var t = $( '.foo' );
var s = t;
t[ t.length++ ] = $Q( '.bar' )[ 0 ]; // should now like like $
( '.foo,.bar' )
assert( s === t, 'object identity broken' )
because we need exactly `t.length` as the target index, as indices
start at 0. (jQuery, unlike the standard Array object, would not
appear to accept assignments to unassigned indices greater than the
length of the object; if done, the result is an `undefined` value
augmented to the jQuery object, but the assignment’s right hand side
gets lost.)
thanx again!
cheers & ~flow