[IMP] Allow app to be mounted in shadow DOM

This commit allow owl Apps to be mounted into a shadow DOM.
This commit is contained in:
tsm-odoo
2023-04-06 10:41:01 +02:00
committed by Géry Debongnie
parent 606421776b
commit c0c40c0387
5 changed files with 94 additions and 7 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import type { Env } from "./app";
import { getCurrent } from "./component_node";
import { onMounted, onPatched, onWillUnmount } from "./lifecycle_hooks";
import { inOwnerDocument } from "./utils";
// -----------------------------------------------------------------------------
// useRef
@@ -16,7 +17,7 @@ export function useRef<T extends HTMLElement = HTMLElement>(name: string): { el:
return {
get el(): T | null {
const el = refs[name];
return el?.ownerDocument.contains(el) ? el : null;
return inOwnerDocument(el) ? el : null;
},
};
}