Bug Tracker

Opened 16 years ago

Closed 15 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:


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 16 years ago by john

Owner: set to john

comment:2 Changed 15 years ago by john

Resolution: fixed
Status: newclosed

Fixed in SVN rev [2783].

Note: See TracTickets for help on using tickets.