@@ -45,6 +45,7 @@ import options from '../options';
4545 * siblings. In most cases, it starts out as `oldChildren[0]._dom`.
4646 * @param {boolean } isHydrating Whether or not we are in hydration
4747 * @param {any[] } refQueue an array of elements needed to invoke refs
48+ * @param {Document } doc The document object to use for creating elements
4849 */
4950export function diff (
5051 parentDom ,
@@ -56,7 +57,8 @@ export function diff(
5657 commitQueue ,
5758 oldDom ,
5859 isHydrating ,
59- refQueue
60+ refQueue ,
61+ doc
6062) {
6163 /** @type {any } */
6264 let tmp ,
@@ -278,7 +280,8 @@ export function diff(
278280 commitQueue ,
279281 oldDom ,
280282 isHydrating ,
281- refQueue
283+ refQueue ,
284+ doc
282285 ) ;
283286
284287 // We successfully rendered this VNode, unset any stored hydration/bailout state:
@@ -366,7 +369,8 @@ export function diff(
366369 excessDomChildren ,
367370 commitQueue ,
368371 isHydrating ,
369- refQueue
372+ refQueue ,
373+ doc
370374 ) ;
371375 }
372376
@@ -431,6 +435,7 @@ function cloneNode(node) {
431435 * to invoke in commitRoot
432436 * @param {boolean } isHydrating Whether or not we are in hydration
433437 * @param {any[] } refQueue an array of elements needed to invoke refs
438+ * @param {Document } doc The document object to use for creating elements
434439 * @returns {PreactElement }
435440 */
436441function diffElementNodes (
@@ -442,7 +447,8 @@ function diffElementNodes(
442447 excessDomChildren ,
443448 commitQueue ,
444449 isHydrating ,
445- refQueue
450+ refQueue ,
451+ doc
446452) {
447453 let oldProps = oldVNode . props ;
448454 let newProps = newVNode . props ;
@@ -485,14 +491,10 @@ function diffElementNodes(
485491
486492 if ( dom == NULL ) {
487493 if ( nodeType == NULL ) {
488- return document . createTextNode ( newProps ) ;
494+ return doc . createTextNode ( newProps ) ;
489495 }
490496
491- dom = document . createElementNS (
492- namespace ,
493- nodeType ,
494- newProps . is && newProps
495- ) ;
497+ dom = doc . createElementNS ( namespace , nodeType , newProps . is && newProps ) ;
496498
497499 // we are creating a new node, so we can assume this is a new subtree (in
498500 // case we are hydrating), this deopts the hydrate
@@ -592,7 +594,8 @@ function diffElementNodes(
592594 ? excessDomChildren [ 0 ]
593595 : oldVNode . _children && getDomSibling ( oldVNode , 0 ) ,
594596 isHydrating ,
595- refQueue
597+ refQueue ,
598+ doc
596599 ) ;
597600
598601 // Remove children that are not part of any vnode.
0 commit comments