browser icon indicating copy to clipboard operation
browser copied to clipboard

events: bubble DOM tree events to window

Open krichprollsch opened this issue 2 years ago • 1 comments

According with the MDN documentation, the DOM tree events must bubble untli the window object.

In addition to the events listed below, many events can bubble from the Document contained in the window object. https://developer.mozilla.org/en-US/docs/Web/API/Window#events

Examples using FF:

var nb = 0;
window.addEventListener('foo', function(event) {nb ++;}, true);
document.getElementById('content').dispatchEvent(new Event('foo'));
nb; // returns 1
var nb = 0;
window.addEventListener('foo', function(event) {nb ++;});
document.getElementById('content').dispatchEvent(new Event('foo', {'bubbles':true}));
nb; // returns 1

But our usage of libdom node dispatch will not take account the pure zig window object.

krichprollsch avatar Jan 19 '24 10:01 krichprollsch

We could register listeners to document with a * type to receive document's events. Then we will able to dispatch these events to widow's listeners.

Maybe we will have to implement the * type into libdom to do so.

krichprollsch avatar Jan 26 '24 15:01 krichprollsch