Skip to content
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-auto-lightbox: Ignore unlaid out elements #26573

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

alanorozco
Copy link
Member

Fixes #25764

@@ -399,6 +399,11 @@ export function apply(ampdoc, element) {
export function runCandidates(ampdoc, candidates) {
return candidates.map(candidate =>
whenLoaded(candidate).then(() => {
// <amp-img> will change the img's src inline data on unlayout and remove
// it from DOM, but a LOAD_END event would still be triggered afterwards.
if (candidate.signals().get(CommonSignals.UNLOAD)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should we move this check to Criteria.meetsAll() to make this method easier to read?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure it makes sense for it to be in that unit particularly since it would be have to be mocked in tests.

whenLoaded would make more sense, but I don't want to create superfluous wrapping promises for something that runs as many times as something as an amp-img appears on every page :(

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

Successfully merging this pull request may close these issues.

Error: null is not an object (evaluating 'c.naturalWidth')
4 participants