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

Method installElement_

src/service/extensions-impl.js:366–380  ·  view source on GitHub ↗

* Installs the specified element implementation in the ampdoc. * @param {!./ampdoc-impl.AmpDoc} ampdoc * @param {string} name * @param {typeof ../base-element.BaseElement} implementationClass * @param {?string|undefined} css * @private

(ampdoc, name, implementationClass, css)

Source from the content-addressed store, hash-verified

364 * @private
365 */
366 installElement_(ampdoc, name, implementationClass, css) {
367 if (css) {
368 installStylesForDoc(
369 ampdoc,
370 css,
371 () => {
372 this.registerElementInWindow_(ampdoc.win, name, implementationClass);
373 },
374 /* isRuntimeCss */ false,
375 name
376 );
377 } else {
378 this.registerElementInWindow_(ampdoc.win, name, implementationClass);
379 }
380 }
381
382 /**
383 * @param {!Window} win

Callers 1

addElementMethod · 0.95

Calls 2

installStylesForDocFunction · 0.90

Tested by

no test coverage detected