File tree Expand file tree Collapse file tree 2 files changed +9
-28
lines changed
packages/svelte/src/internal/client Expand file tree Collapse file tree 2 files changed +9
-28
lines changed Original file line number Diff line number Diff line change @@ -3,56 +3,40 @@ import { DEV } from 'esm-env';
3
3
import { init_array_prototype_warnings } from '../dev/equality.js' ;
4
4
import { current_effect } from '../runtime.js' ;
5
5
6
- // We cache the Node and Element prototype methods, so that we can avoid doing
7
- // expensive prototype chain lookups.
8
-
9
- /** @type {Node } */
10
- var node_prototype ;
11
-
12
- /** @type {Element } */
13
- var element_prototype ;
14
-
15
- /** @type {Text } */
16
- var text_prototype ;
17
-
18
6
// export these for reference in the compiled code, making global name deduplication unnecessary
19
- /**
20
- * @type {Window }
21
- */
7
+ /** @type {Window } */
22
8
export var $window ;
23
- /**
24
- * @type {Document }
25
- */
9
+
10
+ /** @type {Document } */
26
11
export var $document ;
27
12
28
13
/**
29
14
* Initialize these lazily to avoid issues when using the runtime in a server context
30
15
* where these globals are not available while avoiding a separate server entry point
31
16
*/
32
17
export function init_operations ( ) {
33
- if ( node_prototype !== undefined ) {
18
+ if ( $window !== undefined ) {
34
19
return ;
35
20
}
36
21
37
- node_prototype = Node . prototype ;
38
- element_prototype = Element . prototype ;
39
- text_prototype = Text . prototype ;
40
-
41
22
$window = window ;
42
23
$document = document ;
43
24
25
+ var element_prototype = Element . prototype ;
26
+
44
27
// the following assignments improve perf of lookups on DOM nodes
45
28
// @ts -expect-error
46
29
element_prototype . __click = undefined ;
47
30
// @ts -expect-error
48
- text_prototype . __nodeValue = ' ' ;
49
- // @ts -expect-error
50
31
element_prototype . __className = '' ;
51
32
// @ts -expect-error
52
33
element_prototype . __attributes = null ;
53
34
// @ts -expect-error
54
35
element_prototype . __e = undefined ;
55
36
37
+ // @ts -expect-error
38
+ Text . prototype . __nodeValue = ' ' ;
39
+
56
40
if ( DEV ) {
57
41
// @ts -expect-error
58
42
element_prototype . __svelte_meta = null ;
Original file line number Diff line number Diff line change @@ -131,8 +131,6 @@ export function hydrate(component, options) {
131
131
const target = options . target ;
132
132
const previous_hydrate_nodes = hydrate_nodes ;
133
133
134
- let hydrated = false ;
135
-
136
134
try {
137
135
// Don't flush previous effects to ensure order of outer effects stays consistent
138
136
return flush_sync ( ( ) => {
@@ -156,7 +154,6 @@ export function hydrate(component, options) {
156
154
// flush_sync will run this callback and then synchronously run any pending effects,
157
155
// which don't belong to the hydration phase anymore - therefore reset it here
158
156
set_hydrating ( false ) ;
159
- hydrated = true ;
160
157
161
158
return instance ;
162
159
} , false ) ;
You can’t perform that action at this time.
0 commit comments