MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / getLocation

Function getLocation

javascript/atoms/typescript/get-location.ts:45–61  ·  view source on GitHub ↗
(element: Element)

Source from the content-addressed store, hash-verified

43// element is. That makes the width and height fractional and transform-aware
44// where goog.style.getSize's were integer and transform-ignorant.
45function getLocation(element: Element): Bounds | null {
46 if (!isShown(element)) {
47 return null
48 }
49
50 const rect = getClientRect(element)
51 const win = element.ownerDocument.defaultView
52 const scrollX = win ? win.pageXOffset : 0
53 const scrollY = win ? win.pageYOffset : 0
54
55 return {
56 left: rect.left + scrollX,
57 top: rect.top + scrollY,
58 width: rect.width,
59 height: rect.height,
60 }
61}
62
63export default getLocation

Callers

nothing calls this directly

Calls 1

getClientRectFunction · 0.50

Tested by

no test coverage detected