MCPcopy Create free account
hub / github.com/angular/components / getElementWidth

Function getElementWidth

src/cdk-experimental/column-resize/resize-strategy.ts:69–77  ·  view source on GitHub ↗

Gets the style.width pixels on the specified element if present, otherwise its offsetWidth.

(element: HTMLElement)

Source from the content-addressed store, hash-verified

67
68 /** Gets the style.width pixels on the specified element if present, otherwise its offsetWidth. */
69 protected getElementWidth(element: HTMLElement) {
70 // Optimization: Check style.width first as we probably set it already before reading
71 // offsetWidth which triggers layout.
72 return (
73 coercePixelsFromCssValue(element.style.width) ||
74 this._elemSizeCache.get(element)?.width ||
75 element.offsetWidth
76 );
77 }
78
79 /** Informs the ResizeStrategy instance of a column that may be resized in the future. */
80 registerColumn(column: HTMLElement) {

Callers

nothing calls this directly

Calls 2

coercePixelsFromCssValueFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected