MCPcopy Create free account
hub / github.com/ampproject/amphtml / isLayoutSupported

Method isLayoutSupported

src/preact/base-element.js:352–373  ·  view source on GitHub ↗

* @override * @param {import('#core/dom/layout').Layout_Enum} layout

(layout)

Source from the content-addressed store, hash-verified

350 * @param {import('#core/dom/layout').Layout_Enum} layout
351 */
352 isLayoutSupported(layout) {
353 const Ctor = /** @type {typeof PreactBaseElement} */ (
354 /** @type {?} */ (this.constructor)
355 );
356 if (Ctor.layoutSizeDefined) {
357 return (
358 isLayoutSizeDefined(layout) ||
359 // This allows a developer to specify the component's size using the
360 // user stylesheet without the help of AMP's static layout rules.
361 // Bento components use `ContainWrapper` with `contain:strict`, thus
362 // if a user stylesheet doesn't provide for the appropriate size, the
363 // element's size will be 0. The user stylesheet CSS can use
364 // fixed `width`/`height`, `aspect-ratio`, `flex`, `grid`, or any
365 // other CSS layouts coupled with `@media` queries and other CSS tools.
366 // Besides normal benefits of using plain CSS, an important feature of
367 // using this layout is that AMP does not add "sizer" elements thus
368 // keeping the user DOM clean.
369 layout == Layout_Enum.CONTAINER
370 );
371 }
372 return super.isLayoutSupported(layout);
373 }
374
375 /** @override */
376 buildCallback() {

Callers

nothing calls this directly

Calls 1

isLayoutSizeDefinedFunction · 0.90

Tested by

no test coverage detected