Bug Tracker

Ticket #7702 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

.live/.delegate do not work for .load events

Reported by: RTPMatt Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocking: Blocked by:

Description

The docs say .live works for all events now, but I can't seem to make them work for load event. #6143seems to say the same thing, but was closed. Here is my test case:

 http://www.jsfiddle.net/Cj64g/

Change History

comment:1 Changed 4 years ago by anonymous

 http://www.jsfiddle.net/Cj64g/2/

Fixed the delegate tests case, same result.

comment:2 Changed 4 years ago by danheberden

  • Status changed from new to closed
  • Resolution set to invalid

The way that live and delegate work is by using event bubbling. That is, the events that travel up the dom tree, alerting their parents of the activity.

The load event, unfortunately, is not an event that bubbles. (see  http://en.wikipedia.org/wiki/DOM_Events for a list of events and if they bubble)

Good work on distilling the problem down - it looks like you'll do great helping us find and eliminate bugs as we move forward :D

Oh, and as an example of my ramblings, notice how the load event on the parent div doesn't fire:  http://www.jsfiddle.net/danheberden/EpfzF/

Dan

comment:3 Changed 4 years ago by danheberden

To reduce future confusion, we'll update the documentation to specify events that bubble. So good that you brought it to our attention.

comment:4 Changed 4 years ago by danheberden

  • Keywords needsdocs added

comment:5 Changed 4 years ago by danheberden

  • Keywords needsdocs removed
Note: See TracTickets for help on using tickets.