1
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
function getRoot(ele) {
|
||||
return ele?.getRootNode?.();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if is in shadowRoot
|
||||
*/
|
||||
export function inShadow(ele) {
|
||||
return getRoot(ele) instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return shadowRoot if possible
|
||||
*/
|
||||
export function getShadowRoot(ele) {
|
||||
return inShadow(ele) ? getRoot(ele) : null;
|
||||
}
|
||||
Reference in New Issue
Block a user