-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix debug tests #3980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v11-linked-list-prev-index-nextDom-2
Are you sure you want to change the base?
Fix debug tests #3980
Changes from 7 commits
77cff8b
e9c43bd
8565fb2
5a3e91d
e1c5c78
f350e1f
a537134
4d2049e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import { | |
MODE_SVG, | ||
DIRTY_BIT | ||
} from '../constants'; | ||
import { normalizeToVNode, createElement, Fragment } from '../create-element'; | ||
import { createElement, Fragment } from '../create-element'; | ||
import { setProperty } from './props'; | ||
import { createInternal, getParentContext } from '../tree'; | ||
import options from '../options'; | ||
|
@@ -22,12 +22,13 @@ import { commitQueue } from './commit'; | |
/** | ||
* Diff two virtual nodes and apply proper changes to the DOM | ||
* @param {import('../internal').Internal} internal The Internal node to mount | ||
* @param {import('../internal').VNode | string} vnode The vnode that was used to create the internal | ||
* @param {import('../internal').PreactElement} parentDom The element into which this subtree is rendered | ||
* @param {import('../internal').PreactNode} startDom | ||
* @returns {import('../internal').PreactNode | null} pointer to the next DOM node to be hydrated (or null) | ||
*/ | ||
export function mount(internal, parentDom, startDom) { | ||
if (options._diff) options._diff(internal, null); | ||
export function mount(internal, vnode, parentDom, startDom) { | ||
if (options._diff) options._diff(internal, vnode); | ||
|
||
/** @type {import('../internal').PreactNode} */ | ||
let nextDomSibling, prevStartDom; | ||
|
@@ -237,7 +238,13 @@ export function mountChildren(parentInternal, children, parentDom, startDom) { | |
vnode = children[i]; | ||
|
||
// account for holes by incrementing the index: | ||
if (vnode == null || vnode === true || vnode === false) continue; | ||
if ( | ||
vnode == null || | ||
vnode === true || | ||
vnode === false || | ||
typeof vnode === 'function' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we do this typeof once and reuse it's result here and line 249? Same for patch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checked and storing the result in a variable is 10b larger. I think for now it's fine to leave it as is. |
||
) | ||
continue; | ||
else if (Array.isArray(vnode)) vnode = createElement(Fragment, null, vnode); | ||
else if (typeof vnode !== 'object') vnode = String(vnode); | ||
|
||
|
@@ -248,7 +255,7 @@ export function mountChildren(parentInternal, children, parentDom, startDom) { | |
else parentInternal._child = internal; | ||
|
||
// Morph the old element into the new one, but don't append it to the dom yet | ||
mountedNextChild = mount(internal, parentDom, startDom); | ||
mountedNextChild = mount(internal, vnode, parentDom, startDom); | ||
|
||
newDom = internal.data; | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.