25 lines
594 B
JavaScript
25 lines
594 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.getShadowRoot = getShadowRoot;
|
|
exports.inShadow = inShadow;
|
|
function getRoot(ele) {
|
|
var _ele$getRootNode;
|
|
return ele === null || ele === void 0 ? void 0 : (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
|
|
}
|
|
|
|
/**
|
|
* Check if is in shadowRoot
|
|
*/
|
|
function inShadow(ele) {
|
|
return getRoot(ele) instanceof ShadowRoot;
|
|
}
|
|
|
|
/**
|
|
* Return shadowRoot if possible
|
|
*/
|
|
function getShadowRoot(ele) {
|
|
return inShadow(ele) ? getRoot(ele) : null;
|
|
} |