Skip to main content

Bug Tracker

Side navigation

#10717 closed bug (fixed)

Opened November 08, 2011 10:30AM UTC

Closed November 09, 2011 12:32AM UTC

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.

Attachments (0)
Change History (2)

Changed November 08, 2011 02:23PM UTC by dmethvin comment:1

component: unfiledevent
milestone: None1.7.1
owner: → 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.

Changed November 09, 2011 12:32AM UTC by Dave Methvin comment:2

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