Skip to content

🐛 Fix forEach on NodeList#23577

Merged
cvializ merged 1 commit intoampproject:masterfrom
cvializ:fix/for-each
Jul 29, 2019
Merged

🐛 Fix forEach on NodeList#23577
cvializ merged 1 commit intoampproject:masterfrom
cvializ:fix/for-each

Conversation

@cvializ
Copy link
Copy Markdown
Contributor

@cvializ cvializ commented Jul 29, 2019

Related to #21234

getA4AMetaTags returns a NodeList and not an array, and calling forEach on it breaks in IE11.

/**
* Finds all meta tags starting with `amp4ads-vars-`.
* @param {Document} doc
*/
export function getA4AMetaTags(doc) {
const selector = 'meta[name^=amp4ads-vars-]';
return doc.querySelectorAll(selector);
}

Copy link
Copy Markdown
Member

@calebcordry calebcordry left a comment

Choose a reason for hiding this comment

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

IE strikes again :(

@calebcordry
Copy link
Copy Markdown
Member

Thanks for the fix.

@cvializ
Copy link
Copy Markdown
Contributor Author

cvializ commented Jul 29, 2019

Np thanks for the review!

@cvializ cvializ merged commit 809958f into ampproject:master Jul 29, 2019
const tags = getA4AMetaTags(iframeDoc);
const vars = {};
tags.forEach(tag => {
iterateCursor(tags, tag => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's a conflict between this line and #23559. Your PR won the race by a few seconds, so I've sent out a fix in #23584

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants