-
Notifications
You must be signed in to change notification settings - Fork 249
Open
Description
On the latest version of @ampproject/toolbox-optimizer
(v2.9.0
), it appears that certain iframe attributes are being stripped off the iframe. One in particular is the heights
attribute.
Per the AMP docs amp-iframe
should include Common Attributes, with heights being one of the supported attributes for amp-iframe
.
Is there any way around this or an option to not optimize iframe elements?
Many thanks!
--
Script to reproduce:
const AmpOptimizer = require('@ampproject/toolbox-optimizer');
const ampOptimizer = AmpOptimizer.create({});
const body = `<!DOCTYPE html>
<html lang="en" ⚡>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
<title>Test</title>
</head>
<body id="top">
<amp-iframe
title="My iFrame"
width="385"
height="179"
heights="(min-width: 375px) 210px, 80%"
sandbox="allow-scripts allow-same-origin allow-popups"
layout="responsive"
frameborder="0"
id="myIframe"
class="i-amphtml-element i-amphtml-layout-responsive i-amphtml-layout-size-defined i-amphtml-built i-amphtml-layout"
src="https://www3.mydomain.com/pages/embedded-123#amp=1"
resizable=""
allowtransparency=""
i-amphtml-layout="responsive"
scrolling="no"
style="--loader-delay-offset:0ms !important;"
>
<i-amphtml-sizer slot="i-amphtml-svc" style="padding-top: 210px;"></i-amphtml-sizer>
<iframe
class="i-amphtml-fill-content"
name="amp_iframe0"
allowtransparency=""
frameborder="0"
scrolling="no"
title="My iFrame"
allow=""
sandbox="allow-scripts allow-same-origin allow-popups"
src="https://www3.mydomain.com/pages/embedded-123#amp=1"
>
</iframe>
</amp-iframe>
</body>
</html>`;
(async () => {
const optimizedHtml = await ampOptimizer.transformHtml(body);
console.log(optimizedHtml);
})();
Metadata
Metadata
Assignees
Labels
No labels