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

Function createWidgetContainer

ads/vendors/recomad.js:15–34  ·  view source on GitHub ↗

* Add a container for the recomAD widget, * which will be discovered by the script automatically. * * @param {Element} container * @param {string} appId * @param {string} widgetId * @param {string} searchTerm * @param {string} origin * @param {string} baseUrl * @param {string} puid

(
  container,
  appId,
  widgetId,
  searchTerm,
  origin,
  baseUrl,
  puid
)

Source from the content-addressed store, hash-verified

13 * @param {string} puid
14 */
15function createWidgetContainer(
16 container,
17 appId,
18 widgetId,
19 searchTerm,
20 origin,
21 baseUrl,
22 puid
23) {
24 container.className = 's24widget';
25
26 container.setAttribute('data-app-id', appId);
27 container.setAttribute('data-widget-id', widgetId);
28 searchTerm && container.setAttribute('data-search-term', searchTerm);
29 origin && container.setAttribute('data-origin', origin);
30 baseUrl && container.setAttribute('data-base-url', baseUrl);
31 puid && container.setAttribute('data-puid', puid);
32
33 window.document.body.appendChild(container);
34}
35
36/**
37 * @param {!Window} global

Callers 1

recomadFunction · 0.85

Calls 1

setAttributeMethod · 0.45

Tested by

no test coverage detected