This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Can't listen to events on window #57
Comments
I should add that it works fine on var events = new domDelegate.Delegate(document.body);
events.on('click', function() {
console.log('Got a click!');
});
events.on('customEvent', function() {
console.log('Got a custom event!');
});
document.body.dispatchEvent(new CustomEvent('customEvent')); |
If I remember correctly odd, inconsistent (from browser to browser) things happen when you listen to events on the window… @wheresrhys do you remember what we decided to do about this? |
Things are working predictably using native |
Can you try this branch? https://github.com/ftlabs/ftdomdelegate/tree/equalhighlevelthings |
Seems to work for bubbled events, but not for events dispatched directly on the With the following setup: var events = new domDelegate.Delegate(window);
events.on('customEvent', function(evt) {
console.log('Got a custom event!');
}); This isn't doing anything:
But this is: document.body.dispatchEvent(new CustomEvent('customEvent')); |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I would expect the following code to work (see the Fiddle)
None of the event handlers are called.
I'm using the prebuilt version from http://wzrd.in/standalone/dom-delegate@latest in Chrome 38.0.2125.104 on Mac OS X 10.9.5.
The text was updated successfully, but these errors were encountered: