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

Function getPageContainer

3p/facebook.js:108–123  ·  view source on GitHub ↗

* Create DOM element for the Facebook embedded page plugin. * Reference: https://developers.facebook.com/docs/plugins/page-plugin * @param {!Window} global * @param {!Object} data The element data * @return {!Element} div

(global, data)

Source from the content-addressed store, hash-verified

106 * @return {!Element} div
107 */
108function getPageContainer(global, data) {
109 const container = createContainer(global, 'page', data.href);
110 container.setAttribute('data-tabs', data.tabs);
111 container.setAttribute('data-hide-cover', data.hideCover);
112 container.setAttribute('data-show-facepile', data.showFacepile);
113 container.setAttribute('data-hide-cta', data.hideCta);
114 container.setAttribute('data-small-header', data.smallHeader);
115 container.setAttribute('data-adapt-container-width', true);
116
117 const c = global.document.getElementById('c');
118 // Note: The facebook embed allows a maximum width of 500px.
119 // If the container's width exceeds that, the embed's width will
120 // be clipped to 500px.
121 container.setAttribute('data-width', c./*OK*/ offsetWidth);
122 return container;
123}
124
125/**
126 * Create DOM element for the Facebook comments plugin:

Callers 1

getEmbedContainerFunction · 0.85

Calls 3

createContainerFunction · 0.70
setAttributeMethod · 0.45
getElementByIdMethod · 0.45

Tested by

no test coverage detected