File tree 2 files changed +12
-13
lines changed
2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 56
56
'of this node' ) ;
57
57
}
58
58
// remove node from its current position iff it's in a tree.
59
- var isFragment = node . nodeType === Node . DOCUMENT_FRAGMENT_NODE ;
60
- if ( ! isFragment ) {
59
+ if ( node . nodeType !== Node . DOCUMENT_FRAGMENT_NODE ) {
61
60
var parent = TreeApi . Logical . getParentNode ( node ) ;
62
61
// notify existing parent that this node is being removed.
63
62
if ( parent ) {
82
81
} else {
83
82
TreeApi . Composed . appendChild ( container , node ) ;
84
83
}
85
- // if a fragment provoked distribution, clean up it's actual dom.
86
- } else if ( isFragment ) {
87
- while ( node . firstChild ) {
88
- node . removeChild ( node . firstChild ) ;
89
- }
90
84
}
91
85
this . notifyObserver ( ) ;
92
86
return node ;
105
99
TreeApi . Logical . recordInsertBefore ( node , this . node , ref_node ) ;
106
100
}
107
101
// if not distributing and not adding to host, do a fast path addition
108
- return ( this . _maybeDistribute ( node ) ||
102
+ var handled = ( this . _maybeDistribute ( node ) ||
109
103
this . _tryRemoveUndistributedNode ( node ) ) ;
104
+ // if distribution is handling this node and it's a fragment,
105
+ // the actual dom may not be removed from the fragment if some nodes
106
+ // remain undistributed so we ensure removal here.
107
+ if ( handled && ( node . nodeType === Node . DOCUMENT_FRAGMENT_NODE ) ) {
108
+ while ( node . firstChild ) {
109
+ node . removeChild ( node . firstChild ) ;
110
+ }
111
+ }
112
+ return handled ;
110
113
} ,
111
114
112
115
/**
Original file line number Diff line number Diff line change 195
195
// the act of setting this info can affect patched nodes
196
196
// getters; therefore capture childNodes before patching.
197
197
for ( var n = node . firstChild ; n ; n = n . nextSibling ) {
198
- // only link in the child iff it's not already in the container's
199
- // logical tree.
200
- if ( this . getParentNode ( n ) !== container ) {
201
- this . _linkNode ( n , container , ref_node ) ;
202
- }
198
+ this . _linkNode ( n , container , ref_node ) ;
203
199
}
204
200
} else {
205
201
this . _linkNode ( node , container , ref_node ) ;
You can’t perform that action at this time.
0 commit comments