File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -81,18 +81,22 @@ export function interceptInit(callback) { initInterceptors.push(callback) }
8181export function initTree ( el , walker = walk , intercept = ( ) => { } ) {
8282 deferHandlingDirectives ( ( ) => {
8383 walker ( el , ( el , skip ) => {
84- if ( ! el . _x_isInit ) {
85- intercept ( el , skip )
84+ // Prevent initing an element multiple times...
85+ if ( el . _x_inited ) {
86+ el . _x_ignore && skip ( )
8687
87- initInterceptors . forEach ( i => i ( el , skip ) )
88- directives ( el , el . attributes ) . forEach ( handle => handle ( ) )
88+ return
8989 }
9090
91- if ( el . _x_ignore ) {
92- skip ( )
93- } else {
94- el . _x_isInit = true
95- }
91+ intercept ( el , skip )
92+
93+ initInterceptors . forEach ( i => i ( el , skip ) )
94+
95+ directives ( el , el . attributes ) . forEach ( handle => handle ( ) )
96+
97+ el . _x_ignore && skip ( )
98+
99+ el . _x_inited = true
96100 } )
97101 } )
98102}
@@ -101,6 +105,7 @@ export function destroyTree(root) {
101105 walk ( root , el => {
102106 cleanupAttributes ( el )
103107 cleanupElement ( el )
108+
104109 delete el . _x_isInit
105110 } )
106111}
You can’t perform that action at this time.
0 commit comments