Skip to main content

Bug Tracker

Side navigation

#15049 closed bug (notabug)

Opened April 22, 2014 09:11PM UTC

Closed April 22, 2014 09:31PM UTC

Last modified April 22, 2014 09:42PM UTC

Custom triggered change event does not bubble

Reported by: brunoais Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:
Description

Problem:

When change event is programmatically triggered using jQuery, it is not dispatched in the DOM along the controlled jQuery event.

What is:

If I use .change() (or equivalent) without params, and I use DOM's addEventListener() listening to the change event. The addEventListener() in a DOM level 3 compliant browser, it never finds the DOM event.

What should happen:

When .change() (or equivalent) is used without parameters, jQuery should also place the event in the DOM and let it bubble as the spec mentions.

Example:

This code:

http://jsfiddle.net/brunoais/VYFZd/

Should be equivalent to this in jQuery:

http://jsfiddle.net/brunoais/VYFZd/3/

The issue is that the event is never dispatched in the DOM.

Reproducible in:

Chrome 34

Firefox 29b

I'll see if I can make this change myself. I'll ask for help if I fail to do so.

Attachments (0)
Change History (2)

Changed April 22, 2014 09:31PM UTC by rwaldron comment:1

resolution: → notabug
status: newclosed
What is: If I use .change() (or equivalent) without params, and I use DOM's addEventListener() listening to the change event. The addEventListener() in a DOM level 3 compliant browser, it never finds the DOM event.

Correct.

http://jsfiddle.net/brunoais/VYFZd/

This doesn't do anything, I suspect you meant:

document.getElementById('link').onclick = function() {
http://jsfiddle.net/brunoais/VYFZd/3/

And this doesn't do anything because jQuery is never loaded, which doesn't really matter because events bound via vanilla DOM API are out of scope for jQuery.

This works fine: http://jsfiddle.net/rwaldron/d2DVD/

Changed April 22, 2014 09:42PM UTC by brunoais comment:2

YOu are right... Something was wrong there. I was sure that I had used the right link...

This is the correct code of the 1st link:

http://jsfiddle.net/brunoais/VYFZd/6/

The 2nd one... I didn't confirm if it was loaded, tbh. I didn't know it was resetting the selection on the left when I made the update.

Why is it that the event does not exist in the DOM? Why won't it create the event in the DOM?