Skip to main content

Bug Tracker

Side navigation

#14566 closed bug (notabug)

Opened November 22, 2013 03:05AM UTC

Closed November 22, 2013 03:18AM UTC

each function does not check object is iterable

Reported by: me@isnail.info Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:
Description
$.each(obj, function(index, value){
    alert(index);
});

If obj is not an Array or not a String or not an Object, it will raise an error like "Uncaught TypeError: Cannot read property 'length' of undefined ".

I think before define "length=object.length" will check object type.

Attachments (0)
Change History (1)

Changed November 22, 2013 03:18AM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

That would make debugging harder if we covered up mistakes. Pass in valid arguments.