Skip to main content

Bug Tracker

Side navigation

#1236 closed bug (fixed)

Opened May 22, 2007 06:22PM UTC

Closed August 19, 2007 11:38PM UTC

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.

Attachments (0)
Change History (2)

Changed July 21, 2007 01:46PM UTC by john comment:1

milestone: 1.1.31.1.4
owner: → john
version: 1.1.21.1.3

Changed August 19, 2007 11:38PM UTC by john comment:2

resolution: → fixed
status: newclosed

Fixed in SVN rev [2783].