Bug Tracker

Modify

Ticket #8421 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

resolveWith fails on IE8 when called with no "args" argument

Reported by: Martín Soto <donsoto@…> Owned by: jaubourg
Priority: high Milestone: 1.5.2
Component: core Version: 1.5.1
Keywords: Cc:
Blocking: Blocked by:

Description

Deferred's resolveWith method fails on IE8 (with and without IE7 compat mode) when called without its second argument ("args"), e.g.,

d = $.Deferred();
...
d.resolveWith(this);

According to the docs, this arguments is optional, so this would be a valid call, and it indeed works as expected on at least Firefox and Chrome. IE, on the other hand, fails with an "Object expected" error.

A very small test case for the problem is available at  http://jsfiddle.net/martinsoto/BLDTG/. It affects both jQuery 1.5 and 1.5.1.

I could trace this to the apply call at line 862 of jquery-1.5.1.js:

callbacks.shift().apply( context, args );

When resolveWith is called without the args argument, apply gets called here with an undefined but explicit second argument. This evidently makes IE choke.

Change History

comment:1 Changed 3 years ago by jaubourg

  • Owner set to jaubourg
  • Priority changed from undecided to high
  • Status changed from new to assigned
  • Component changed from unfiled to core
  • Milestone changed from 1.next to 1.5.2

very good catch :)

Last edited 3 years ago by jaubourg (previous) (diff)

comment:2 Changed 3 years ago by jaubourg

  • Status changed from assigned to closed
  • Resolution set to fixed

Used the wrong format to notify the fix in the commit message.

 https://github.com/jquery/jquery/commit/c1279895f3f33cacc08e508c2409b587c0e6a5a2

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.