Merge pull request #1727 from jnoordsij/fix_shadowroot

Fix shadowroot
This commit is contained in:
Sam Potts 2020-03-29 11:17:33 +11:00 committed by GitHub
commit be3ffc1f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ class Fullscreen {
const element = !this.prefix ? document.fullscreenElement : document[`${this.prefix}${this.property}Element`];
return element === this.target;
return (element && element.shadowRoot) ? element === this.target.getRootNode().host : element === this.target;
}
// Get target element

View File

@ -221,7 +221,7 @@ export function hasClass(element, className) {
// Element matches selector
export function matches(element, selector) {
const prototype = { Element };
const prototype = Element.prototype;
function match() {
return Array.from(document.querySelectorAll(selector)).includes(this);