Home / Function/ assign_locations() — svelte Function Reference

assign_locations() — svelte Function Reference

Architecture documentation for the assign_locations() function in elements.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  233b118d_2b48_c1cf_411e_4773053d6a2b["assign_locations()"]
  3ab252dc_d6ce_1bc4_5889_915271359ea9["elements.js"]
  233b118d_2b48_c1cf_411e_4773053d6a2b -->|defined in| 3ab252dc_d6ce_1bc4_5889_915271359ea9
  b60eae80_564e_15ac_1592_842fc3d3102d["add_locations()"]
  b60eae80_564e_15ac_1592_842fc3d3102d -->|calls| 233b118d_2b48_c1cf_411e_4773053d6a2b
  60ba5ce9_8764_d9b0_98e6_a8d41ea4a9cc["assign_location()"]
  60ba5ce9_8764_d9b0_98e6_a8d41ea4a9cc -->|calls| 233b118d_2b48_c1cf_411e_4773053d6a2b
  60ba5ce9_8764_d9b0_98e6_a8d41ea4a9cc["assign_location()"]
  233b118d_2b48_c1cf_411e_4773053d6a2b -->|calls| 60ba5ce9_8764_d9b0_98e6_a8d41ea4a9cc
  style 233b118d_2b48_c1cf_411e_4773053d6a2b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/dev/elements.js lines 46–63

function assign_locations(node, filename, locations) {
	var i = 0;
	var depth = 0;

	while (node && i < locations.length) {
		if (hydrating && node.nodeType === COMMENT_NODE) {
			var comment = /** @type {Comment} */ (node);
			if (comment.data === HYDRATION_START || comment.data === HYDRATION_START_ELSE) depth += 1;
			else if (comment.data[0] === HYDRATION_END) depth -= 1;
		}

		if (depth === 0 && node.nodeType === ELEMENT_NODE) {
			assign_location(/** @type {Element} */ (node), filename, locations[i++]);
		}

		node = node.nextSibling;
	}
}

Domain

Subdomains

Frequently Asked Questions

What does assign_locations() do?
assign_locations() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dev/elements.js.
Where is assign_locations() defined?
assign_locations() is defined in packages/svelte/src/internal/client/dev/elements.js at line 46.
What does assign_locations() call?
assign_locations() calls 1 function(s): assign_location.
What calls assign_locations()?
assign_locations() is called by 2 function(s): add_locations, assign_location.

Analyze Your Own Codebase

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

Try Supermodel Free