New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amp-bind: Don't get stuck on sibling-less amp-list #23333
amp-bind: Don't get stuck on sibling-less amp-list #23333
Conversation
|
||
// But cousins and the amp-list itself shouldn't be skipped. | ||
expect(list.className).to.equal('x'); | ||
expect(cousin.textContent).to.equal('6'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified this line fails without the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this require a cherry-pick?
extensions/amp-bind/0.1/bind-impl.js
Outdated
skipSubtree_(walker) { | ||
let n = walker.currentNode; | ||
while (n) { | ||
if (n.nextSibling) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use walker.parentNode()
and walker.nextSibling()
only. As is, this will traverse outside of the walker's root and scan unrelated DOM trees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, done.
* Don't get stuck on sibling-less amp-list. * Use nextSibling/parentNode. * Yikes infinite loop.
* Don't get stuck on sibling-less amp-list. * Use nextSibling/parentNode. * Yikes infinite loop.
* Don't get stuck on sibling-less amp-list. * Use nextSibling/parentNode. * Yikes infinite loop.
Fixes #23281.
/to @jridgewell