You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order for these events to be captured, I had considered adding them to the document instead of the window, using a suitable condition.
But instead it made much more sense to set the base listener directly as the document.
Of course, it brought with it the question of how we can listen to the window events.
It may seem counterintuitive at first glance, but after all, this is a delegation library. People may want to delegate the div element for it's child span. With this requirement, what I will say below has become meaningful.
Structurally, there will still be a selector entry, but we will also require a delegate element, and this will be optional.
events.(element,event,selector,callback)
If element is left blank, it will be document by default.
People will be able to type something like events.(window, 'load', '', function (event) { to listen for window events.
They will also be able to properly add non-working events, such as events.('mouseleave', '.selector', function (event) {, thanks to the document.
In addition to all these, "events.(document.querySelector ('#element'), 'click', '.selector', function (event) {" will be added to the project as an additional feature.
Changing the base listener
divelement for it's childspan. With this requirement, what I will say below has become meaningful.events.(window, 'load', '', function (event) {to listen for window events.events.('mouseleave', '.selector', function (event) {, thanks to the document.