Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#950 closed bug (wontfix)

jQuery.fn.ready should not pass in any params to the functions pushed onto readyList

Reported by: [email protected] Owned by:
Priority: minor Milestone:
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

Description

foo function(arg) {

alert(arg)

}

$("document").ready(foo);

ready is passing in a function to foo, so the function code is displayed. arg should be null. This is the expected behavior and is neccessary if foo is a shared function.

Change History (1)

comment:1 in reply to:  description Changed 15 years ago by john

Resolution: wontfix
Status: newclosed
Version: 1.1a

ready is passing in a function to foo, so the function code is displayed. arg should be null. This is the expected behavior and is neccessary if foo is a shared function.

That's correct. We added this such that you could call jQuery by any name within your program scope. For example:

  jQuery(document).ready($){
    $("div").hide();
  });

or:

  jQuery(function($){
    $("div").hide();
  });

So, yes, it doesn't behave like a normal event (in that it doesn't pass in an Event Object), but this event also isn't a normal event. In this case, we're taking advantage of that fact by providing an incredibly useful feature, for users who work in conflicting-code situations.

Note: See TracTickets for help on using tickets.