Choices
Choices copied to clipboard
[BUGFIX] Check for constructor name of element on bootstrap
Description
The previous check using instanceof
fails in case the Choices.js component is rendered in the top
frame while the JavaScript actually using Choices.js is in an iframe.
The conditions are changed to check for constructor.name
now, solving the issue.
Due to the rather messy constructor, some quirks like operational chaining and explicit type casts need to be used to make the TypeScript compiling process happy.
This fixes #1057.
Screenshots (if appropriate)
Types of changes
- [ ] Chore (tooling change or documentation change)
- [ ] Refactor (non-breaking change which maintains existing functionality)
- [x] 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
- [x] My code follows the code style of this project.
- [ ] I have added new tests for the bug I fixed/the new feature I added.
- [ ] I have modified existing tests for the bug I fixed/the new feature I added.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.