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

Add compatibility with web components #278

Merged
merged 3 commits into from
Dec 5, 2019
Merged

Conversation

leofavre
Copy link
Contributor

@leofavre leofavre commented Dec 5, 2019

Description

Imaskjs breaks when used inside web components.

iMask Bug

This happens because Imaskjs relies on document.activeElement to detect if an input element is active, but if it is inside a shadowDOM (i.e. inside a web component) a false negative is returned.

This PR solves the problem by using this.input.getRootNode instead of document, with a fallback to document for browsers that do not support it.

@coveralls
Copy link

coveralls commented Dec 5, 2019

Coverage Status

Coverage increased (+0.3%) to 63.341% when pulling 328d1bb on leofavre:master into 08f728d on uNmAnNeR:master.

@leofavre leofavre marked this pull request as ready for review December 5, 2019 03:21
@uNmAnNeR
Copy link
Owner

uNmAnNeR commented Dec 5, 2019

cool! thanks

@uNmAnNeR uNmAnNeR merged commit 6e7b33d into uNmAnNeR:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants