MCPcopy Index your code
hub / github.com/ampproject/amphtml / getFrameAttributes

Function getFrameAttributes

src/3p-frame.js:33–44  ·  view source on GitHub ↗

* Produces the attributes for the ad template. * @param {!Window} parentWindow * @param {!AmpElement} element * @param {string=} opt_type * @param {Object=} opt_context * @return {!JsonObject} Contains * - type, width, height, src attributes of tag. These have * precedence

(parentWindow, element, opt_type, opt_context)

Source from the content-addressed store, hash-verified

31 * - A _context object for internal use.
32 */
33function getFrameAttributes(parentWindow, element, opt_type, opt_context) {
34 const type = opt_type || element.getAttribute('type');
35 userAssert(type, 'Attribute type required for <amp-ad>: %s', element);
36 const sentinel = generateSentinel(parentWindow);
37 let attributes = {};
38 // Do these first, as the other attributes have precedence.
39 addDataAndJsonAttributes_(element, attributes);
40 attributes = getContextMetadata(parentWindow, element, sentinel, attributes);
41 attributes['type'] = type;
42 Object.assign(attributes['_context'], opt_context);
43 return attributes;
44}
45
46/**
47 * Creates the iframe for the embed. Applies correct size and passes the embed

Callers 1

getIframeFunction · 0.85

Calls 6

userAssertFunction · 0.90
getContextMetadataFunction · 0.90
generateSentinelFunction · 0.85
getAttributeMethod · 0.80
assignMethod · 0.80

Tested by

no test coverage detected