MCPcopy
hub / github.com/angular/components / getComputedLeft

Function getComputedLeft

src/material/grid-list/grid-list.spec.ts:526–535  ·  view source on GitHub ↗

Gets the `left` position of an element.

(element: DebugElement)

Source from the content-addressed store, hash-verified

524
525/** Gets the `left` position of an element. */
526function getComputedLeft(element: DebugElement): number {
527 // While the other properties in this test use `getComputedStyle`, we use `getBoundingClientRect`
528 // for left because iOS Safari doesn't support using `getComputedStyle` to get the calculated
529 // `left` value when using CSS `calc`. We subtract the `left` of the document body because
530 // browsers, by default, add a margin to the body (typically 8px).
531 const elementRect = element.nativeElement.getBoundingClientRect();
532 const bodyRect = document.body.getBoundingClientRect();
533
534 return elementRect.left - bodyRect.left;
535}
536
537@Component({
538 template: '<mat-grid-list></mat-grid-list>',

Callers 1

grid-list.spec.tsFile · 0.85

Calls 1

getBoundingClientRectMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…