File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
packages/svelte/src/internal/client/dom Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " svelte " : patch
3
+ ---
4
+
5
+ chore: improve runtime overhead of creating comment templates
Original file line number Diff line number Diff line change @@ -251,7 +251,18 @@ export function text(anchor) {
251
251
return push_template_node ( node ) ;
252
252
}
253
253
254
- export const comment = template ( '<!>' , TEMPLATE_FRAGMENT | TEMPLATE_USE_IMPORT_NODE ) ;
254
+ export function comment ( ) {
255
+ // we're not delegating to `template` here for performance reasons
256
+ if ( hydrating ) {
257
+ return push_template_node ( hydrate_nodes ) ;
258
+ }
259
+ var frag = document . createDocumentFragment ( ) ;
260
+ var anchor = empty ( ) ;
261
+ frag . append ( anchor ) ;
262
+ push_template_node ( [ anchor ] ) ;
263
+
264
+ return frag ;
265
+ }
255
266
256
267
/**
257
268
* Assign the created (or in hydration mode, traversed) dom elements to the current block
You can’t perform that action at this time.
0 commit comments