Bug Tracker

Opened 9 years ago

Closed 9 years ago

#14860 closed bug (notabug)

jQuery isArray does not work correctly

Reported by: chihungyu1116@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.0-rc1
Keywords: Cc:
Blocked by: Blocking:

Description

var tags = document.getElementsByTagName('div');

jQuery.isArray(tags) returns false Array.isArray(tags) returns false

function isArray(object){

return typeof object === "object" && object.length > -1;

}

isArray(tags) return true

shouldn't the implemtation be more like the one I have above?

https://stackoverflow.com/questions/22237597/jquery-and-array-isarray-not-working-correctly

Change History (1)

comment:1 Changed 9 years ago by Rick Waldron

Resolution: notabug
Status: newclosed

document.getElementsByTagName('div') doesn't return an Array, it returns a live NodeList

Note: See TracTickets for help on using tickets.