MCPcopy
hub / github.com/ampproject/amphtml / wrap

Function wrap

src/compiler/builders.ts:24–31  ·  view source on GitHub ↗

* Wraps a buildDom function with functionality that every component needs.

(buildDom: BuildDom)

Source from the content-addressed store, hash-verified

22 * Wraps a buildDom function with functionality that every component needs.
23 */
24function wrap(buildDom: BuildDom): BuildDom {
25 return function wrapper(element) {
26 applyStaticLayout(element as AmpElement);
27 buildDom(element);
28 element.setAttribute('i-amphtml-ssr', '');
29 element.classList.add('i-amphtml-element');
30 };
31}
32
33/**
34 * Returns the set of component builders needed to server-render an AMP Document.

Callers 1

getBuildersFunction · 0.70

Calls 4

applyStaticLayoutFunction · 0.90
buildDomFunction · 0.90
setAttributeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected