persistedHeadElement() — astro Function Reference
Architecture documentation for the persistedHeadElement() function in swap-functions.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD a6c8ec10_528f_0d13_d591_45ce3d9d7bd4["persistedHeadElement()"] 12084e8e_15f3_27ac_8f8b_d442375ff33d["swap-functions.ts"] a6c8ec10_528f_0d13_d591_45ce3d9d7bd4 -->|defined in| 12084e8e_15f3_27ac_8f8b_d442375ff33d 0722731f_183d_e797_27e9_3e58fdf1d7de["swapHeadElements()"] 0722731f_183d_e797_27e9_3e58fdf1d7de -->|calls| a6c8ec10_528f_0d13_d591_45ce3d9d7bd4 style a6c8ec10_528f_0d13_d591_45ce3d9d7bd4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/transitions/swap-functions.ts lines 154–165
const persistedHeadElement = (el: HTMLElement, newDoc: Document): Element | null => {
const id = el.getAttribute(PERSIST_ATTR);
const newEl = id && newDoc.head.querySelector(`[${PERSIST_ATTR}="${id}"]`);
if (newEl) {
return newEl;
}
if (el.matches('link[rel=stylesheet]')) {
const href = el.getAttribute('href');
return newDoc.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
}
return null;
};
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does persistedHeadElement() do?
persistedHeadElement() is a function in the astro codebase, defined in packages/astro/src/transitions/swap-functions.ts.
Where is persistedHeadElement() defined?
persistedHeadElement() is defined in packages/astro/src/transitions/swap-functions.ts at line 154.
What calls persistedHeadElement()?
persistedHeadElement() is called by 1 function(s): swapHeadElements.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free