bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

js: simplify bootstrapDelegationHandler function

Open DenisLopatin opened this issue 5 months ago • 0 comments

Closes #41116

Description

The bootstrapDelegationHandler function has been changed as suggested by @frkly. Added a test that verifies that the bootstrapDelegationHandler callback finds the desired element. Fixed tests in js/tests/unit/util/focustrap.spec.js, two tests used document for dispatchEvent, document does not have closest. As I understand it, the only way to get to this case is testing, since EventHandler is a private API.

Motivation & Context

The parent element search function can be simplified. Current support for the closest is 96.01%

Type of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Refactoring (non-breaking change)
  • [ ] Breaking change (fix or feature that would change existing functionality)

Checklist

  • [x] I have read the contributing guidelines
  • [x] My code follows the code style of the project (using npm run lint)
  • [ ] My change introduces changes to the documentation
  • [ ] I have updated the documentation accordingly
  • [x] I have added tests to cover my changes
  • [x] All new and existing tests passed

DenisLopatin avatar Aug 29 '25 22:08 DenisLopatin