Hi all...

I've come across something that I think is a little odd, but I'm not
sure if I'm just being dumb.  Have a look at this:

$(function() {
  var $div = $("<div>");

  var $divs = $();

  $divs.add($div);

  console.log($divs.length); // == 0

  $divs = $().add($div);

  console.log($divs.length); // == 1
});

Logic tells me that $divs.length should be 1 in both cases.

I've tested this with 1.3.2 and 1.4 and they both do the same thing,
with the exception that in 1.3.2 the $() call creates a jQuery object
with the document object in it, so the numbers return 1 and 2 instead
of 0 and 1.

Any ideas?

Cheers,

Matt Parlane

Reply via email to