Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7610 closed enhancement (invalid)

.ready (and .readyWait) should really be implemented using the Events API

Reported by: cowboy Owned by:
Priority: low Milestone:
Component: event Version: 1.4.4
Keywords: needsreview Cc:
Blocked by: Blocking:

Description

Ideally, .ready( fn ) and $( fn ) should both be shortcuts for .bind( "ready", fn ), perhaps with the exception that fn in .ready( fn ) and $( fn ) is curried so that $ is passed in as a function argument instead of event (or is passed in before the event argument).

Instead of some plugin incrementing the .readyWait property to indicate that the "ready" event needs to be deferred, that plugin could instead bind a "ready" event handler that calls e.preventDefault() or e.stopPropagation() (as necessary depending on the implementation) to prevent other "ready" event handlers from firing. Once the plugin is actually ready, it could then unbind itself and re-trigger the "ready" event.

Or something along those lines.

Either way, it would be nice for the "ready" event to behave more similarly to other jQuery events, instead of being a somewhat awkward special case.

This could tie into #7279. Also, .readyWait was introduced in #6781.

Change History (2)

comment:1 Changed 9 years ago by Rick Waldron

Component: unfiledevent
Keywords: needsreview added
Priority: undecidedlow
Status: newopen

comment:2 Changed 9 years ago by dmethvin

Resolution: invalid
Status: openclosed

We've implemented .ready in terms of Deferreds now, and will be committing cowboy's unit tests to be sure it doesn't break.

Note: See TracTickets for help on using tickets.