MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / shouldSizeToContent

Method shouldSizeToContent

src/utils.ts:225–229  ·  view source on GitHub ↗

* Check if a widget should resize to fit its content. * * @param n the grid node to check (can be undefined) * @param strict if true, only returns true for explicit sizeToContent:true (not numbers) * @returns true if the widget should resize to content * * @example * if (Utils.s

(n: GridStackNode | undefined, strict = false)

Source from the content-addressed store, hash-verified

223 * }
224 */
225 static shouldSizeToContent(n: GridStackNode | undefined, strict = false): boolean {
226 return n?.grid && (strict ?
227 (n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) :
228 (!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false)));
229 }
230
231 /**
232 * Check if two grid positions overlap/intersect.

Callers 6

loadMethod · 0.80
_prepareElementMethod · 0.80
resizeToContentCheckMethod · 0.80
_resizeStartMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected