Home / Function/ getElementsPositionInDocument() — astro Function Reference

getElementsPositionInDocument() — astro Function Reference

Architecture documentation for the getElementsPositionInDocument() function in highlight.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  2b091c95_28b1_301f_48da_924efa99c779["getElementsPositionInDocument()"]
  21d4971d_ea22_2699_3ba8_0047fd0c2969["highlight.ts"]
  2b091c95_28b1_301f_48da_924efa99c779 -->|defined in| 21d4971d_ea22_2699_3ba8_0047fd0c2969
  style 2b091c95_28b1_301f_48da_924efa99c779 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts lines 29–44

export function getElementsPositionInDocument(el: Element) {
	let isFixed = false;
	let current: Element | ParentNode | null = el;
	while (current instanceof Element) {
		// all the way up the tree. We are only doing so when the app initializes, so the cost is one-time
		// If perf becomes an issue we'll want to refactor this somehow so that it reads this info in a rAF
		let style = getComputedStyle(current);
		if (style.position === 'fixed') {
			isFixed = true;
		}
		current = current.parentNode;
	}
	return {
		isFixed,
	};
}

Domain

Subdomains

Frequently Asked Questions

What does getElementsPositionInDocument() do?
getElementsPositionInDocument() is a function in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts.
Where is getElementsPositionInDocument() defined?
getElementsPositionInDocument() is defined in packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts at line 29.

Analyze Your Own Codebase

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

Try Supermodel Free