From 7f35349409009d5e53c83b64ce79caae62b4274f Mon Sep 17 00:00:00 2001 From: Randolf J Date: Thu, 1 Sep 2022 14:41:41 +0200 Subject: [PATCH 1/5] chore: remove unnecessary type signature --- src/common/Frame.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/common/Frame.ts b/src/common/Frame.ts index bb99290827567..ebc32a6f84698 100644 --- a/src/common/Frame.ts +++ b/src/common/Frame.ts @@ -771,12 +771,25 @@ export class Frame { content += `//# sourceURL=${path.replace(/\n/g, '')}`; } +<<<<<<< HEAD type = type ?? 'text/javascript'; return this.worlds[MAIN_WORLD].transferHandle( await this.worlds[PUPPETEER_WORLD].evaluateHandle( async ({url, id, type, content}) => { const script = document.createElement('script'); +======= + return this.worlds[PUPPETEER_WORLD].evaluateHandle( + async ({url, id, type, content}) => { + const script = document.createElement('script'); + if (url) { + script.src = url; + } + if (id) { + script.id = id; + } + if (type) { +>>>>>>> 571c30c3e5 (chore: remove unnecessary type signature) script.type = type; script.text = content; if (url) { From 90985801d702c254e3d46ded140c3c003049f43d Mon Sep 17 00:00:00 2001 From: Randolf J Date: Thu, 1 Sep 2022 16:44:16 +0200 Subject: [PATCH 2/5] chore: fix tests --- src/common/Frame.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/Frame.ts b/src/common/Frame.ts index ebc32a6f84698..a7d9d43d1b956 100644 --- a/src/common/Frame.ts +++ b/src/common/Frame.ts @@ -772,12 +772,16 @@ export class Frame { } <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 2563c0600e (chore: fix tests) type = type ?? 'text/javascript'; return this.worlds[MAIN_WORLD].transferHandle( await this.worlds[PUPPETEER_WORLD].evaluateHandle( async ({url, id, type, content}) => { const script = document.createElement('script'); +<<<<<<< HEAD ======= return this.worlds[PUPPETEER_WORLD].evaluateHandle( async ({url, id, type, content}) => { @@ -790,6 +794,8 @@ export class Frame { } if (type) { >>>>>>> 571c30c3e5 (chore: remove unnecessary type signature) +======= +>>>>>>> 2563c0600e (chore: fix tests) script.type = type; script.text = content; if (url) { From b37ce1013ab97fe97da03b6a55569c5deb209907 Mon Sep 17 00:00:00 2001 From: Randolf J Date: Thu, 1 Sep 2022 14:34:41 +0200 Subject: [PATCH 3/5] chore: migrate `addStyleTag` --- docs/api/puppeteer.frame.addstyletag.md | 16 ++--- docs/api/puppeteer.frame.addstyletag_1.md | 25 +++++++ docs/api/puppeteer.frame.md | 3 +- docs/api/puppeteer.page.addstyletag.md | 20 +++--- docs/api/puppeteer.page.addstyletag_1.md | 25 +++++++ docs/api/puppeteer.page.md | 3 +- src/common/Frame.ts | 71 ++++++++++++++++-- src/common/IsolatedWorld.ts | 87 ----------------------- src/common/Page.ts | 34 ++++++--- 9 files changed, 160 insertions(+), 124 deletions(-) create mode 100644 docs/api/puppeteer.frame.addstyletag_1.md create mode 100644 docs/api/puppeteer.page.addstyletag_1.md diff --git a/docs/api/puppeteer.frame.addstyletag.md b/docs/api/puppeteer.frame.addstyletag.md index 5b00d734afa3b..7ca3032cf1461 100644 --- a/docs/api/puppeteer.frame.addstyletag.md +++ b/docs/api/puppeteer.frame.addstyletag.md @@ -4,26 +4,26 @@ sidebar_label: Frame.addStyleTag # Frame.addStyleTag() method -Adds a `` tag into the page with the desired url or a `