Home / Function/ swapRootAttributes() — astro Function Reference

swapRootAttributes() — astro Function Reference

Architecture documentation for the swapRootAttributes() function in swap-functions.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  94f93c11_1632_0337_26d3_3aec800b8f89["swapRootAttributes()"]
  12084e8e_15f3_27ac_8f8b_d442375ff33d["swap-functions.ts"]
  94f93c11_1632_0337_26d3_3aec800b8f89 -->|defined in| 12084e8e_15f3_27ac_8f8b_d442375ff33d
  af9df8a2_d80a_7f14_9281_908d8b85f14f["swap()"]
  af9df8a2_d80a_7f14_9281_908d8b85f14f -->|calls| 94f93c11_1632_0337_26d3_3aec800b8f89
  style 94f93c11_1632_0337_26d3_3aec800b8f89 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/transitions/swap-functions.ts lines 43–51

export function swapRootAttributes(newDoc: Document) {
	const currentRoot = document.documentElement;
	const nonOverridableAstroAttributes = [...currentRoot.attributes].filter(
		({ name }) => (currentRoot.removeAttribute(name), NON_OVERRIDABLE_ASTRO_ATTRS.includes(name)),
	);
	[...newDoc.documentElement.attributes, ...nonOverridableAstroAttributes].forEach(
		({ name, value }) => currentRoot.setAttribute(name, value),
	);
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does swapRootAttributes() do?
swapRootAttributes() is a function in the astro codebase, defined in packages/astro/src/transitions/swap-functions.ts.
Where is swapRootAttributes() defined?
swapRootAttributes() is defined in packages/astro/src/transitions/swap-functions.ts at line 43.
What calls swapRootAttributes()?
swapRootAttributes() is called by 1 function(s): swap.

Analyze Your Own Codebase

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

Try Supermodel Free