jQuery: The Write Less, Do More JavaScript Library

how to add elements to a jQuery object without copying it

by ~flow :: Rate this Message:

Reply to Author | View in Thread


i seem to remember i asked this question before, but am unable to
retrieve that post---given a jQuery object with a collection of DOM
nodes, how can i append another DOM node (like `[].push()` would do)
to that collection without breaking object identity? i need

  var t = $( '.foo' );
  var s = t;
  t.push( '.bar' ); // should now like like $( '.foo,.bar' )
  assert( s === t, 'object identity broken' )

any ideas what to write for `$().push`?

cheers & ~flow

 « Return to Thread: how to add elements to a jQuery object without copying it