.getBox()
Available on: InDom

Returns a DOMRect with the underlying element’s viewport-relative bounding box.

Returns: {DOMRect} - Native object with left / x, top / y, width, height, right, bottom.

Throws:
Error - If the underlying element has been removed
Error - If the underlying element is not connected to the document

Examples:
const div = $n('<div></div>');
div.setStyle({
	display: 'inline-block',
	position: 'fixed',
	top: '110px',
	left: '130px',
	width: '100px',
	height: '150px',
	backgroundColor: 'blue'
});

//console.log(div.getBox());
console.log(JSON.stringify(div.getBox()));
//DOMRect {"x":0,"y":0,"width":0,"height":0,"top":0,"right":0,"bottom":0,"left":0}
//because it is not yet connected to DOM 

$1('body').append(div);
console.log(div.getBox());
console.log(JSON.stringify(div.getBox()));
//DOMRect {"x":130,"y":110,"width":100,"height":150,"top":110,"right":230,
//"bottom":260,"left":130}
Modern DOM Power
for TypeScript, ESM & Plain JS
3.8KB JavaScript library that simplifies DOM manipulation
with a clean, chainable API for events, data, inputs harvesting, and more.
Automatic Cleanup,
Leak-Proof by Design
Events and state are cleared when elements leave the DOM,
even if removal happens outside InDom.
Cleaner Code,
Better Ergonomics
Get the InDom object directly in callbacks.
One element, one instance.
Works With Your Existing Stack
Use InDom on its own or alongside any library or framework,
its architecture ensures a seamless integration.