Skip to main content

Bug Tracker

Side navigation

#14000 closed bug (notabug)

Opened June 07, 2013 01:50AM UTC

Closed June 07, 2013 02:07AM UTC

jQuery.merge does not consider the nodelist

Reported by: goodluckyibiyihua@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.2
Keywords: Cc:
Blocked by: Blocking:
Description
var list1 = document.querySelectorAll(".lists1 li"); //list1.length = 20
var list2 = $(".lists2 li"); //list2.length = 20
var result = $.merge(list1,list2);

console.log(result.length); // it is 20,because the nodelist's length can't been modified


I think this situation is very common.

Thanks!

Attachments (0)
Change History (1)

Changed June 07, 2013 02:07AM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

Working as documented. http://api.jquery.com/jquery.merge/

A Nodelist is array-like but not an Array. This method is intended mainly for our internal use. We never call it with a Nodelist as the first arg.