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

Method init

third_party/subscriptions-project/swg.js:8747–8767  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8745 /**
8746 */
8747 init() {
8748 const head = this.doc_.getHead();
8749 if (!head) {
8750 return;
8751 }
8752
8753 const url = 'https://news.google.com/swg/js/v1/swg-button.css';
8754 const existing = head.querySelector(`link[href="${url}"]`);
8755 if (existing) {
8756 return;
8757 }
8758
8759 // <link rel="stylesheet" href="..." type="text/css">
8760 head.appendChild(
8761 createElement(this.doc_.getWin().document, 'link', {
8762 'rel': 'stylesheet',
8763 'type': 'text/css',
8764 'href': url,
8765 })
8766 );
8767 }
8768
8769 /**
8770 * @param {!../api/subscriptions.ButtonOptions|function()} optionsOrCallback

Callers

nothing calls this directly

Calls 3

createElementFunction · 0.70
getHeadMethod · 0.45
getWinMethod · 0.45

Tested by

no test coverage detected