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

Method installShadowDoc

src/service/ampdoc-impl.js:192–200  ·  view source on GitHub ↗

* Creates and installs the ampdoc for the shadow root. * @param {string} url * @param {!ShadowRoot} shadowRoot * @param {!AmpDocOptions=} opt_options * @return {!AmpDocShadow} * @restricted

(url, shadowRoot, opt_options)

Source from the content-addressed store, hash-verified

190 * @restricted
191 */
192 installShadowDoc(url, shadowRoot, opt_options) {
193 devAssert(
194 !shadowRoot[AMPDOC_PROP],
195 'The shadow root already contains ampdoc'
196 );
197 const ampdoc = new AmpDocShadow(this.win, url, shadowRoot, opt_options);
198 shadowRoot[AMPDOC_PROP] = ampdoc;
199 return ampdoc;
200 }
201
202 /**
203 * Creates and installs the ampdoc for the fie root.

Callers 3

test-ampdoc.jsFile · 0.80
attachShadowDoc_Method · 0.80

Calls 1

devAssertFunction · 0.90

Tested by

no test coverage detected