Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve whole-page performance by scoping events handlers #740

Merged
merged 7 commits into from
Nov 12, 2019
Merged

improve whole-page performance by scoping events handlers #740

merged 7 commits into from
Nov 12, 2019

Conversation

tinovyatkin
Copy link
Contributor

@tinovyatkin tinovyatkin commented Nov 5, 2019

Description

This is a further improvement over #703 and #696. We have mousedown event handler in capture mode for document.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 and mouseover 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

  • Chore (tooling change or documentation change)
  • Refactor (non-breaking change which maintains existing functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@tinovyatkin tinovyatkin changed the title make isIE11 a const improve whole-page performance by scooping mousedown handler Nov 5, 2019
@tinovyatkin tinovyatkin changed the title improve whole-page performance by scooping mousedown handler improve whole-page performance by scoping mousedown handler Nov 5, 2019
@tinovyatkin tinovyatkin changed the title improve whole-page performance by scoping mousedown handler improve whole-page performance by scoping mousedown and keydown handlers Nov 5, 2019
@tinovyatkin tinovyatkin changed the title improve whole-page performance by scoping mousedown and keydown handlers improve whole-page performance by scoping events handlers Nov 5, 2019
@jshjohnson jshjohnson added the refactor Pull request that refactors existing functionality label Nov 5, 2019
src/scripts/choices.js Show resolved Hide resolved
@jshjohnson jshjohnson merged commit 8775bac into Choices-js:master Nov 12, 2019
@tinovyatkin tinovyatkin deleted the scope-mouse-down branch November 13, 2019 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull request that refactors existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants