-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏗 Visual diff updates and fixes (#35942)
* Update visual diff's Chrome version to 91.0.4472.0 * Remove page-preparation snippets that are now included in Percy's serializer library * :%s/.percyCss/.percyCSS/ * Remove <noscript> elements from doc/iframes * Restore <canvas> → <img> freezer
- Loading branch information
1 parent
b226f9d
commit ce36ba5
Showing
3 changed files
with
30 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
build-system/tasks/visual-diff/snippets/freeze-form-values.js
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
build-system/tasks/visual-diff/snippets/remove-no-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @fileoverview This file is executed via Puppeteer's page.evaluate on a | ||
* document to remove all <noscript> tags, from the main document and iframes. | ||
* This makes for cleaner diffs and prevents "double-execution" of AMP scripts | ||
* when enableJavaScript=false. | ||
*/ | ||
|
||
/** | ||
* Removes <noscript> elements from doc and its iframes. | ||
* @param {Document} doc document to operate on recursively. | ||
*/ | ||
function removeNoscript(doc) { | ||
doc.querySelectorAll('noscript').forEach((node) => node./*OK*/ remove()); | ||
|
||
doc.body.querySelectorAll('iframe').forEach((iframe) => { | ||
if (iframe.contentDocument) { | ||
removeNoscript(iframe.contentDocument); | ||
} | ||
}); | ||
} | ||
|
||
removeNoscript(document); |