improve whole-page performance by scoping events handlers #740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a further improvement over #703 and #696. We have
mousedown
event handler in capture mode fordocument.documentElement
, while inside of it immediately returning if element is not part of outerContainer. So, that logically means we should initially set our target element properly.Similar logic was applied to
keydown
andmouseover
handlers.Also fixed here invalid arguments and target for
removeEventListener
, introduces by #703 (sorry 🤷🏼♂️)While we were here, reimplemented #710 in a little bit more performant way and with support for LTR/RLT directions.
Noticing, that
isIE11
util had being used only at mouse down handler and that result of this function call are always constant for the same browser, replacing it with a constant and using feature detection instead of userAgent sniffing.As a result of the above refactorings removed two obsolete helpers from
utils
.Screenshots (if appropriate)
Types of changes
Checklist