WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 236e1ab

Browse files
committed
Add ignore children to morph
1 parent 3bb1bad commit 236e1ab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/morph/src/morph.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ export function morph(from, toHtml, options) {
3434
}
3535

3636
let updateChildrenOnly = false
37+
let skipChildren = false
3738

38-
if (shouldSkip(updating, from, to, () => updateChildrenOnly = true)) return
39+
if (shouldSkip(updating, from, to, () => updateChildrenOnly = true, () => skipChildren = true)) return
3940

4041
// Initialize the server-side HTML element with Alpine...
4142
if (from.nodeType === 1 && window.Alpine) {
@@ -60,7 +61,9 @@ export function morph(from, toHtml, options) {
6061

6162
updated(from, to)
6263

63-
patchChildren(from, to)
64+
if (! skipChildren) {
65+
patchChildren(from, to)
66+
}
6467
}
6568

6669
function differentElementNamesTypesOrKeys(from, to) {

0 commit comments

Comments
 (0)