1
- import { createIf , effectScope , insert , remove , renderEffect } from 'vue'
1
+ import {
2
+ VaporFragment ,
3
+ effectScope ,
4
+ insert ,
5
+ isFragment ,
6
+ remove ,
7
+ renderEffect ,
8
+ } from 'vue'
2
9
3
- const VaporFragment = createIf ( ( ) => { } ) . __proto__ . __proto__ . constructor
4
10
function createFragment ( nodes ) {
5
11
const frag = new VaporFragment ( nodes )
6
12
frag . anchor = document . createTextNode ( '' )
@@ -10,7 +16,7 @@ function createFragment(nodes) {
10
16
function normalizeValue ( value ) {
11
17
return value == null || typeof value === 'boolean'
12
18
? document . createTextNode ( '' )
13
- : value instanceof Node || value instanceof VaporFragment
19
+ : value instanceof Node || isFragment ( value )
14
20
? value
15
21
: Array . isArray ( value )
16
22
? createFragment ( value . map ( normalizeValue ) )
@@ -20,15 +26,15 @@ function normalizeValue(value) {
20
26
function resolveValue ( current , value ) {
21
27
const node = normalizeValue ( value )
22
28
if ( current ) {
23
- if ( current instanceof VaporFragment ) {
29
+ if ( isFragment ( current ) ) {
24
30
const { anchor } = current
25
31
if ( anchor . parentNode ) {
26
32
remove ( current . nodes , anchor . parentNode )
27
33
insert ( node , anchor . parentNode , anchor )
28
34
anchor . remove ( )
29
35
}
30
36
} else if ( current . nodeType ) {
31
- if ( node instanceof VaporFragment && current . parentNode ) {
37
+ if ( isFragment ( node ) && current . parentNode ) {
32
38
insert ( node , current . parentNode , current )
33
39
current . remove ( )
34
40
} else if ( current . nodeType === 3 && node . nodeType === 3 ) {
0 commit comments