Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/optimizer/lib/transformers/OptimizeAmpBind.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class OptimizeAmpBind {
for (let node = html; node !== null; node = nextNode(node)) {
if (isTemplate(node)) {
node = skipNodeAndChildren(node);
continue;
if (node === null) {
break;
} else {
continue;
}
Comment on lines +48 to +50
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else block containing only 'continue' is unnecessary. The continue statement can be moved outside the if-else block since it should execute in both cases when node is not null.

Suggested change
} else {
continue;
}
}
continue;

Copilot uses AI. Check for mistakes.
}

const {attribs} = node;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html ⚡ i-amphtml-binding>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
</head>
<body>
<div data-amp-bind-text="foo" i-amphtml-binding>Hello, AMP world.</div>
<template id="my-template">Must be the very last element. Whitespace after closing tag would alter the test.</template>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
</head>
<body>
<div data-amp-bind-text="foo">Hello, AMP world.</div>
<template id="my-template">Must be the very last element. Whitespace after closing tag would alter the test.</template></body></html>