Skip to content

Commit

Permalink
Check if documentHeight has changed after all elements initially built (
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell authored and rochapablo committed Aug 30, 2021
1 parent e5eb534 commit 871e4c6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/service/resources-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,18 @@ export class ResourcesImpl {
dev().fine(TAG_, 'document height on load: %s', this.contentHeight_);
}

// Once we know the document is fully parsed, we check to see if every AMP Element has been built
const firstPassAfterAllBuilt =
!this.firstPassAfterDocumentReady_ &&
this.firstPassAfterAllBuilt_ &&
this.resources_.every(
(r) => r.getState() != Resource.NOT_BUILT || r.element.R1()
);
if (firstPassAfterAllBuilt) {
this.firstPassAfterAllBuilt_ = false;
this.maybeChangeHeight_ = true;
}

const viewportSize = this.viewport_.getSize();
dev().fine(
TAG_,
Expand Down

0 comments on commit 871e4c6

Please sign in to comment.