From 6e7c6368d3d560f24be0a736f33f202d8e2a80b5 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 6 Sep 2022 12:39:55 +0200 Subject: [PATCH] docs: fix example formatting in evaluateOnNewDocument (#8906) --- docs/api/puppeteer.page.evaluateonnewdocument.md | 8 ++++---- src/common/Page.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/api/puppeteer.page.evaluateonnewdocument.md b/docs/api/puppeteer.page.evaluateonnewdocument.md index 2a3c53bfcc2..66f94b2dd4d 100644 --- a/docs/api/puppeteer.page.evaluateonnewdocument.md +++ b/docs/api/puppeteer.page.evaluateonnewdocument.md @@ -43,13 +43,13 @@ An example of overriding the navigator.languages property before the page loads: // overwrite the `languages` property to use a custom getter Object.defineProperty(navigator, 'languages', { -get: function () { -return ['en-US', 'en', 'bn']; -}, + get: function () { + return ['en-US', 'en', 'bn']; + }, }); // In your puppeteer script, assuming the preload.js file is -in same folder of our script +// in same folder of our script. const preloadFile = fs.readFileSync('./preload.js', 'utf8'); await page.evaluateOnNewDocument(preloadFile); ``` diff --git a/src/common/Page.ts b/src/common/Page.ts index e97517d3544..0f078cc40ab 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -2784,13 +2784,13 @@ export class Page extends EventEmitter { * * // overwrite the `languages` property to use a custom getter * Object.defineProperty(navigator, 'languages', { - * get: function () { - * return ['en-US', 'en', 'bn']; - * }, + * get: function () { + * return ['en-US', 'en', 'bn']; + * }, * }); * * // In your puppeteer script, assuming the preload.js file is - * in same folder of our script + * // in same folder of our script. * const preloadFile = fs.readFileSync('./preload.js', 'utf8'); * await page.evaluateOnNewDocument(preloadFile); * ```