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

Method assertPosition_

extensions/amp-iframe/0.1/amp-iframe.js:170–185  ·  view source on GitHub ↗

@private

()

Source from the content-addressed store, hash-verified

168
169 /** @private */
170 assertPosition_() {
171 const pos = this.element.getLayoutBox();
172 const minTop = Math.min(600, this.getViewport().getSize().height * 0.75);
173 userAssert(
174 pos.top >= minTop,
175 '<amp-iframe> elements must be positioned outside the first 75% ' +
176 'of the viewport or 600px from the top (whichever is smaller): %s ' +
177 ' Current position %s. Min: %s' +
178 "Positioning rules don't apply for iframes that use `placeholder`." +
179 'See https://github.com/ampproject/amphtml/blob/main/extensions/' +
180 'amp-iframe/amp-iframe.md#iframe-with-placeholder for details.',
181 this.element,
182 pos.top,
183 minTop
184 );
185 }
186
187 /**
188 * @param {string} sandbox

Callers 1

layoutCallbackMethod · 0.95

Calls 4

userAssertFunction · 0.90
getViewportMethod · 0.80
getLayoutBoxMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected