Skip to content

Commit

Permalink
chore: set allowViewportExpansion to captureBeyondViewport
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Sep 22, 2023
1 parent 18ba47e commit 53e2ceb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/puppeteer-core/src/api/ElementHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ export abstract class ElementHandle<
const {
scrollIntoView = true,
captureBeyondViewport = true,
allowViewportExpansion = true,
allowViewportExpansion = captureBeyondViewport,
} = options;

let clip = await this.#nonEmptyVisibleBoundingBox();
Expand All @@ -1347,7 +1347,7 @@ export abstract class ElementHandle<

// eslint-disable-next-line @typescript-eslint/no-unused-vars
await using _ =
(captureBeyondViewport || allowViewportExpansion) && clip
allowViewportExpansion && clip
? await page._createTemporaryViewportContainingBox(clip)
: null;

Expand All @@ -1373,7 +1373,6 @@ export abstract class ElementHandle<
return await page.screenshot({
...options,
captureBeyondViewport: false,
allowViewportExpansion: false,
clip,
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/api/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
}

options.captureBeyondViewport ??= true;
options.allowViewportExpansion ??= true;
options.allowViewportExpansion ??= options.captureBeyondViewport;
options.clip = options.clip && roundClip(normalizeClip(options.clip));

await using stack = new AsyncDisposableStack();
Expand Down

0 comments on commit 53e2ceb

Please sign in to comment.