Skip to content

Commit caab8da

Browse files
authored
chore: remove unused code (#11762)
* chore: remove unused code * remove text_prototype * more
1 parent fec57e2 commit caab8da

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

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

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,40 @@ import { DEV } from 'esm-env';
33
import { init_array_prototype_warnings } from '../dev/equality.js';
44
import { current_effect } from '../runtime.js';
55

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-
186
// export these for reference in the compiled code, making global name deduplication unnecessary
19-
/**
20-
* @type {Window}
21-
*/
7+
/** @type {Window} */
228
export var $window;
23-
/**
24-
* @type {Document}
25-
*/
9+
10+
/** @type {Document} */
2611
export var $document;
2712

2813
/**
2914
* Initialize these lazily to avoid issues when using the runtime in a server context
3015
* where these globals are not available while avoiding a separate server entry point
3116
*/
3217
export function init_operations() {
33-
if (node_prototype !== undefined) {
18+
if ($window !== undefined) {
3419
return;
3520
}
3621

37-
node_prototype = Node.prototype;
38-
element_prototype = Element.prototype;
39-
text_prototype = Text.prototype;
40-
4122
$window = window;
4223
$document = document;
4324

25+
var element_prototype = Element.prototype;
26+
4427
// the following assignments improve perf of lookups on DOM nodes
4528
// @ts-expect-error
4629
element_prototype.__click = undefined;
4730
// @ts-expect-error
48-
text_prototype.__nodeValue = ' ';
49-
// @ts-expect-error
5031
element_prototype.__className = '';
5132
// @ts-expect-error
5233
element_prototype.__attributes = null;
5334
// @ts-expect-error
5435
element_prototype.__e = undefined;
5536

37+
// @ts-expect-error
38+
Text.prototype.__nodeValue = ' ';
39+
5640
if (DEV) {
5741
// @ts-expect-error
5842
element_prototype.__svelte_meta = null;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ export function hydrate(component, options) {
131131
const target = options.target;
132132
const previous_hydrate_nodes = hydrate_nodes;
133133

134-
let hydrated = false;
135-
136134
try {
137135
// Don't flush previous effects to ensure order of outer effects stays consistent
138136
return flush_sync(() => {
@@ -156,7 +154,6 @@ export function hydrate(component, options) {
156154
// flush_sync will run this callback and then synchronously run any pending effects,
157155
// which don't belong to the hydration phase anymore - therefore reset it here
158156
set_hydrating(false);
159-
hydrated = true;
160157

161158
return instance;
162159
}, false);

0 commit comments

Comments
 (0)