Bug Tracker

Opened 5 years ago

Closed 5 years ago

#15143 closed bug (notabug)

jQuery wont listen to native custom namespaced events

Reported by: toddmhorst Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.1
Keywords: Cc:
Blocked by: Blocking:

Description

Summary

Namespaced native custom events are not being listened to by jquery.

I believe this is a bug because without namespacing jquery will listen to native events.

History

I stumbled upon this as I was creating a pure js library. I chose this because nothing inherently needed jquery, so why force my user to use it when there was no need for the dependance.

That said, if they were using it, as I always do, then I wanted to provide them some examples and some extra sugar.

In doing the examples I noticed it was not working as expected. I've read multiple places on the benefits of namespacing so I would like to keep it. Doing the basic searches on google came up empty. I posted on stackoverflow here (http://stackoverflow.com/questions/24192500/jquery-on-isnt-listening-to-custom-native-js-event#) but the general public couldnt provide a workaround.

Examples

Here jquery creates event and native listens (fail) 1.x http://jsfiddle.net/thorst/699M4/1/ 2.x http://jsfiddle.net/thorst/SXd6G/3/

Here native creates event and jquery listens (success) 1.x http://jsfiddle.net/thorst/PnrFe/1/ 2.x http://jsfiddle.net/thorst/Uw2y3/1/

Here jquery creates namespaced event and native listens (fail) 1.x http://jsfiddle.net/thorst/ehXfy/1/ 2.x http://jsfiddle.net/thorst/2MtXf/1/

Here native creates namespaced event and jquery listens (fail) 1.x http://jsfiddle.net/thorst/Rk3zn/3/ 2.x http://jsfiddle.net/thorst/YJr62/1/

One Last Thing

Im guessing this last point wont be possible due to its implementation, but it would be nice if native js could listen to jquery custom events. While its use case is less obvious, I still believe there could be instances where this could be useful. If not though its not a huge deal, just let me know and I'll pursue getting the documentation updated with this small note.

Thank you for your time.

Change History (1)

comment:1 Changed 5 years ago by dmethvin

Resolution: notabug
Status: newclosed

jQuery does not attempt to trigger native events. If you'd like to suggest a documentation change at https://github.com/jquery/api.jquery.com/issues that would be fine.

Note: See TracTickets for help on using tickets.