@@ -58,6 +58,16 @@ export function RegularElement(node, context) {
58
58
return ;
59
59
}
60
60
61
+ const is_custom_element = is_custom_element_node ( node ) ;
62
+
63
+ if ( is_custom_element ) {
64
+ // cloneNode is faster, but it does not instantiate the underlying class of the
65
+ // custom element until the template is connected to the dom, which would
66
+ // cause problems when setting properties on the custom element.
67
+ // Therefore we need to use importNode instead, which doesn't have this caveat.
68
+ context . state . metadata . context . template_needs_import_node = true ;
69
+ }
70
+
61
71
if ( node . name === 'script' ) {
62
72
context . state . metadata . context . template_contains_script_tag = true ;
63
73
}
@@ -79,16 +89,6 @@ export function RegularElement(node, context) {
79
89
/** @type {ExpressionStatement[] } */
80
90
const lets = [ ] ;
81
91
82
- const is_custom_element = is_custom_element_node ( node ) ;
83
-
84
- if ( is_custom_element ) {
85
- // cloneNode is faster, but it does not instantiate the underlying class of the
86
- // custom element until the template is connected to the dom, which would
87
- // cause problems when setting properties on the custom element.
88
- // Therefore we need to use importNode instead, which doesn't have this caveat.
89
- context . state . metadata . context . template_needs_import_node = true ;
90
- }
91
-
92
92
/** @type {Map<string, AST.Attribute> } */
93
93
const lookup = new Map ( ) ;
94
94
0 commit comments