Bug Tracker

Ticket #11719 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Deprecate .bind("ready") event

Reported by: dmethvin Owned by: dmethvin
Priority: low Milestone: 1.8
Component: event Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

The "ready" event is error prone because users may attach an event handler after it has fired. It is much more natural for ready semantics to follow the Promise model; if handlers are added after the document is ready then they will fire. We're adding a ready Promise in 1.8 (see #11470) and of course the standard $(fn) or $().ready(fn) continue to work without change.

Let's deprecate the ready event as of 1.8; there is no hurry to remove it, but let's help users avoid dumb errors caused by dumb APIs.

Change History

comment:1 Changed 3 years ago by dmethvin

  • Owner set to dmethvin
  • Priority changed from undecided to low
  • Status changed from new to assigned
  • Component changed from unfiled to event
  • Milestone changed from None to 1.8

Just to be absolutely clear what is being deprecated here, it is these forms:

$(document).bind("ready", fn);
$(document).on("ready", fn);

Where "ready" is a custom event name that is only fired once by jQuery when the document becomes ready.

comment:2 Changed 3 years ago by dmethvin

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

Documentation updated.

Note: See TracTickets for help on using tickets.