Skip to content

Commit

Permalink
feat: allow use documents other than window.document during render
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro00dk committed May 24, 2023
1 parent 679bf6d commit f91ada4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/dom-expressions/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function render(code, element, init, options = {}) {
element === document
? code()
: insert(element, code(), element.firstChild ? null : undefined, init);
}, options.owner);
}, { ...options.owner, document: element.ownerDocument });
return () => {
disposer();
element.textContent = "";
Expand All @@ -67,7 +67,7 @@ export function template(html, isCE, isSVG) {
};
// backwards compatible with older builds
const fn = isCE
? () => untrack(() => document.importNode(node || (node = create()), true))
? () => untrack(() => (getOwner().document || document).importNode(node || (node = create()), true))
: () => (node || (node = create())).cloneNode(true);
fn.cloneNode = fn;
return fn;
Expand Down

0 comments on commit f91ada4

Please sign in to comment.