Bug Tracker

Opened 11 years ago

Closed 11 years ago

#10717 closed bug (fixed)

A triggered load bubbles up to window

Reported by: Boldewyn Owned by: dmethvin
Priority: low Milestone: 1.7.1
Component: event Version: 1.7
Keywords: Cc:
Blocked by: Blocking:

Description

Consider this JSFiddle:

http://jsfiddle.net/Ytzd9/

A function is bound via $(window).load(). Then the load event is triggered on an external resource element (in this case an image):

$('img#foo').trigger(load);

  • Actual output:

The load event bubbles up from the image to the window object.

  • Expected output:

The event should not bubble. Native load events on images, iframes, ... don't bubble to the parent window, too.

Change History (2)

comment:1 Changed 11 years ago by dmethvin

Component: unfiledevent
Milestone: None1.7.1
Owner: set to dmethvin
Priority: undecidedlow
Status: newassigned

This was introduced in 1.5 as a consequence of events now bubbling to window (as the W3C Events Level 3 spec says they should). However, you're right that the load event isn't supposed to bubble *at all*; a browser event doesn't but our triggered event does. That's easily fixable in 1.7.1 with the new special events hooks.

comment:2 Changed 11 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Fix #10717, .trigger("load") on images can't bubble to window.

This means no manually triggered event named "load" can bubble, so avoid that name for delegated custom events.

Changeset: 45101de6962186a21bc557d1c55ec4844dfb241e

Note: See TracTickets for help on using tickets.