Home / File/ operations.js — svelte Source File

operations.js — svelte Source File

Architecture documentation for operations.js, a javascript file in the svelte codebase. 10 imports, 15 dependents.

File javascript ClientRuntime DOMOperations 10 imports 15 dependents 14 functions

Entity Profile

Dependency Diagram

graph LR
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0["operations.js"]
  f3948b0d_b92a_0767_ba6c_832767f4e2bb["hydration.js"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> f3948b0d_b92a_0767_ba6c_832767f4e2bb
  40f27ad3_30bb_8f2a_3fb3_757088cf7428["set_hydrate_node"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> 40f27ad3_30bb_8f2a_3fb3_757088cf7428
  9fcf2863_565e_f328_30b3_46748f0e7489["equality.js"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> 9fcf2863_565e_f328_30b3_46748f0e7489
  ff98bd09_e6fd_2deb_9709_503ac689db35["init_array_prototype_warnings"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> ff98bd09_e6fd_2deb_9709_503ac689db35
  cb946435_ce66_d1e8_6bee_287bdb07e7c5["utils.js"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> cb946435_ce66_d1e8_6bee_287bdb07e7c5
  bde4209f_8ffc_1594_4024_b1835a44bcf6["runtime.js"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> bde4209f_8ffc_1594_4024_b1835a44bcf6
  3c211218_0172_f6af_dd4f_da8028a531fc["index.js"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> 3c211218_0172_f6af_dd4f_da8028a531fc
  d8e42d9d_2e3c_635c_19d3_b946a4341c0f["batch.js"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> d8e42d9d_2e3c_635c_19d3_b946a4341c0f
  c9866d91_a204_fa55_a9e3_6bcc6aaaec1e["esm-env"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> c9866d91_a204_fa55_a9e3_6bcc6aaaec1e
  54c2bfce_50b6_b8cc_4371_e1e14f283fb3["constants"]
  9a9bbc27_46b6_021c_6d77_f736ed4b40f0 --> 54c2bfce_50b6_b8cc_4371_e1e14f283fb3
  6d3d606a_fb7a_54af_1ece_f1eb12f174d1["boundary.js"]
  6d3d606a_fb7a_54af_1ece_f1eb12f174d1 --> 9a9bbc27_46b6_021c_6d77_f736ed4b40f0
  ee9aaeee_d18b_8f23_1c50_ace68f975516["branches.js"]
  ee9aaeee_d18b_8f23_1c50_ace68f975516 --> 9a9bbc27_46b6_021c_6d77_f736ed4b40f0
  4d06167e_1009_096b_88b0_99ef50b8fbad["css-props.js"]
  4d06167e_1009_096b_88b0_99ef50b8fbad --> 9a9bbc27_46b6_021c_6d77_f736ed4b40f0
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa["each.js"]
  ca0d28d0_c4b0_db5c_32c9_bdad64d5deaa --> 9a9bbc27_46b6_021c_6d77_f736ed4b40f0
  style 9a9bbc27_46b6_021c_6d77_f736ed4b40f0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { Effect, TemplateNode } from '#client' */
import { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';
import { DEV } from 'esm-env';
import { init_array_prototype_warnings } from '../dev/equality.js';
import { get_descriptor, is_extensible } from '../../shared/utils.js';
import { active_effect } from '../runtime.js';
import { async_mode_flag } from '../../flags/index.js';
import { TEXT_NODE, EFFECT_RAN } from '#client/constants';
import { eager_block_effects } from '../reactivity/batch.js';

// export these for reference in the compiled code, making global name deduplication unnecessary
/** @type {Window} */
export var $window;

/** @type {Document} */
export var $document;

/** @type {boolean} */
export var is_firefox;

/** @type {() => Node | null} */
var first_child_getter;
/** @type {() => Node | null} */
var next_sibling_getter;

/**
 * Initialize these lazily to avoid issues when using the runtime in a server context
 * where these globals are not available while avoiding a separate server entry point
 */
export function init_operations() {
	if ($window !== undefined) {
		return;
	}

	$window = window;
	$document = document;
	is_firefox = /Firefox/.test(navigator.userAgent);

	var element_prototype = Element.prototype;
	var node_prototype = Node.prototype;
	var text_prototype = Text.prototype;

	// @ts-ignore
	first_child_getter = get_descriptor(node_prototype, 'firstChild').get;
	// @ts-ignore
	next_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;

	if (is_extensible(element_prototype)) {
		// the following assignments improve perf of lookups on DOM nodes
		// @ts-expect-error
		element_prototype.__click = undefined;
		// @ts-expect-error
		element_prototype.__className = undefined;
		// @ts-expect-error
		element_prototype.__attributes = null;
		// @ts-expect-error
		element_prototype.__style = undefined;
		// @ts-expect-error
		element_prototype.__e = undefined;
	}
// ... (234 more lines)

Domain

Subdomains

Frequently Asked Questions

What does operations.js do?
operations.js is a source file in the svelte codebase, written in javascript. It belongs to the ClientRuntime domain, DOMOperations subdomain.
What functions are defined in operations.js?
operations.js defines 14 function(s): child, clear_text_content, create_comment, create_element, create_fragment, create_text, first_child, get_first_child, get_next_sibling, init_operations, and 4 more.
What does operations.js depend on?
operations.js imports 10 module(s): batch.js, constants, equality.js, esm-env, hydration.js, index.js, init_array_prototype_warnings, runtime.js, and 2 more.
What files import operations.js?
operations.js is imported by 15 file(s): boundary.js, branches.js, css-props.js, customizable-select.js, each.js, effects.js, error-handling.js, html.js, and 7 more.
Where is operations.js in the architecture?
operations.js is located at packages/svelte/src/internal/client/dom/operations.js (domain: ClientRuntime, subdomain: DOMOperations, directory: packages/svelte/src/internal/client/dom).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free