* @param {!Window} global * @param {!Object} data * @return {?Node}
(global, data)
| 49 | * @return {?Node} |
| 50 | */ |
| 51 | function createContainer(global, data) { |
| 52 | // add canonical link tag |
| 53 | addCanonicalLinkTag(global); |
| 54 | |
| 55 | // create div |
| 56 | const container = global.document.createElement('container'); |
| 57 | container.className = 'BeOpinionWidget'; |
| 58 | |
| 59 | // get content id |
| 60 | if (data['content'] !== null) { |
| 61 | container.setAttribute('data-content', data['content']); |
| 62 | } |
| 63 | |
| 64 | // get my-content value, forcing it to '1' if it is not an amp-ad |
| 65 | if (global.context.tagName === 'AMP-BEOPINION') { |
| 66 | container.setAttribute('data-my-content', '1'); |
| 67 | } else if (data['my-content'] !== null) { |
| 68 | container.setAttribute('data-my-content', data['my-content']); |
| 69 | } |
| 70 | |
| 71 | // get slot name |
| 72 | if (data['name'] !== null) { |
| 73 | container.setAttribute('data-name', data['name']); |
| 74 | } |
| 75 | |
| 76 | setStyles(container, { |
| 77 | width: '100%', |
| 78 | display: 'block', |
| 79 | }); |
| 80 | |
| 81 | return container; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @param {*} global |
no test coverage detected