Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#15049 closed bug (notabug)

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.

Change History (2)

comment:1 Changed 6 years ago by Rick Waldron

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/

comment:2 Changed 6 years ago by brunoais

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?

Note: See TracTickets for help on using tickets.