Skip to content

Changing the base listener #10

@ionurboz

Description

@ionurboz

Changing the base listener

  • We found out that there were some events that the window was not listening to. [BUG] It cannot catch and listen for "mouseleave" and "mouseenter" events. #9
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions