Bug Tracker

Opened 13 years ago

Closed 13 years ago

#1236 closed bug (fixed)

Extend should not die before processing all of its arguments.

Reported by: daemach Owned by: john
Priority: major Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: Cc:
Blocked by: Blocking:

Description

The $.extend() documentation says:

$.extend( Object target, Object prop1, Object propN ) returns Object Extend one object with one or more others, returning the original, modified, object.

Currently, $.extend dies after hitting a undefined value, even if there are more valid arguments in the list. This is not good behavior. Consider the following:

this.settings = jQuery.extend({}, this.defaults, arguments.options, this.userOptionsFromCookie); named to illustrate purpose

If I don't need to pass the function any arguments, arguments.options is undefined. I still want user options to modify the defaults however. Rather than using a while != null loop, you should be using a for loop to ensure that all arguments are processed. An argument with an undefined value should be ignored but it shouldn't halt processing.

Change History (2)

comment:1 Changed 13 years ago by john

Milestone: 1.1.31.1.4
Owner: set to john
Version: 1.1.21.1.3

comment:2 Changed 13 years ago by john

Resolution: fixed
Status: newclosed

Fixed in SVN rev [2783].

Note: See TracTickets for help on using tickets.