Home / Function/ deselectScripts() — astro Function Reference

deselectScripts() — astro Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

packages/astro/src/transitions/swap-functions.ts lines 22–35

export function deselectScripts(doc: Document) {
	for (const s2 of doc.scripts) {
		if (
			// Check if the script should be rerun regardless of it being the same
			!s2.hasAttribute('data-astro-rerun') &&
			// Check if the script has already been executed
			detectScriptExecuted(s2)
		) {
			// the old script is in the new document and doesn't have the rerun attribute
			// we mark it as executed to prevent re-execution
			s2.dataset.astroExec = '';
		}
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does deselectScripts() do?
deselectScripts() is a function in the astro codebase, defined in packages/astro/src/transitions/swap-functions.ts.
Where is deselectScripts() defined?
deselectScripts() is defined in packages/astro/src/transitions/swap-functions.ts at line 22.
What does deselectScripts() call?
deselectScripts() calls 1 function(s): detectScriptExecuted.
What calls deselectScripts()?
deselectScripts() 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