Skip to content

Commit 4c9d71f

Browse files
authored
chore: init map prototype methods eagerly (#10544)
Co-authored-by: Rich Harris <[email protected]>
1 parent 7032837 commit 4c9d71f

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

packages/svelte/src/internal/client/operations.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,17 @@ var element_prototype;
1414
var text_prototype;
1515

1616
/** @type {Map<any, any>} */
17-
var map_prototype;
17+
var map_prototype = Map.prototype;
18+
var map_set_method = map_prototype.set;
19+
var map_get_method = map_prototype.get;
20+
var map_delete_method = map_prototype.delete;
1821

1922
/** @type {typeof Node.prototype.appendChild} */
2023
var append_child_method;
2124

2225
/** @type {typeof Node.prototype.cloneNode} */
2326
var clone_node_method;
2427

25-
/** @type {typeof Map.prototype.set} */
26-
var map_set_method;
27-
28-
/** @type {typeof Map.prototype.get} */
29-
var map_get_method;
30-
31-
/** @type {typeof Map.prototype.delete} */
32-
var map_delete_method;
33-
3428
/** @type {(this: Node) => ChildNode | null} */
3529
var first_child_get;
3630

@@ -65,13 +59,9 @@ export function init_operations() {
6559
node_prototype = Node.prototype;
6660
element_prototype = Element.prototype;
6761
text_prototype = Text.prototype;
68-
map_prototype = Map.prototype;
6962

7063
append_child_method = node_prototype.appendChild;
7164
clone_node_method = node_prototype.cloneNode;
72-
map_set_method = map_prototype.set;
73-
map_get_method = map_prototype.get;
74-
map_delete_method = map_prototype.delete;
7565

7666
$window = window;
7767
$document = document;

0 commit comments

Comments
 (0)