Bug 1850820 [wpt PR 41722] - [Clipboard] Write well-formed HTML to the clipboard...
commit3912966d18523b1934187c6c6e3a242f42956df0
authorAnupam Snigdha <snianu@microsoft.com>
Wed, 18 Oct 2023 08:36:35 +0000 (18 08:36 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Thu, 26 Oct 2023 08:55:47 +0000 (26 08:55 +0000)
tree1e160d542862e8ffa17f5b655f66f037a7c08f9e
parent95be2b6463f8d544b3043e7b29002040c4d5c878
Bug 1850820 [wpt PR 41722] - [Clipboard] Write well-formed HTML to the clipboard using async API., a=testonly

Automatic update from web-platform-tests
[Clipboard] Write well-formed HTML to the clipboard using async API.

In this change we use the below algorithm to write a well-formed HTML document
to the clipboard using `write()` method:
1. Create a DOMParser using blink::DOMParser::Create.
2. Call DOMParser’s parseFromString method to parse the html string provided
   by the web authors.
3. Serialize the document returned from step 2.
4. Return the serialized html string from step 3.

Input to async write method:
"<head><script><\/script><style> p {font-color: red; background-color: blue;}</style></head> <body><p>html text</p></body>"

Output to the clipboard:
"<html><head><script></script><style> p {font-color: red; background-color: blue;}</style></head> <body><p>html text</p></body></html>"

Explainer: https://github.com/w3c/editing/blob/gh-pages/docs/clipboard-unsanitized/explainer.md

Bug: 1268679
Change-Id: Ia1973d47400717a32b3218900ab900f061b2ce02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4811743
Commit-Queue: Anupam Snigdha <snianu@microsoft.com>
Reviewed-by: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1205576}

--

wpt-commits: a70bfbabfecca734b244ec975bbb8ef0c03db78b
wpt-pr: 41722
testing/web-platform/tests/clipboard-apis/async-unsanitized-standard-html-formats-write-read.tentative.https.html [deleted file]