[w3c/clipboard-apis] [clipboard-apis] .write() for text/html doesn't define a canonical form (Issue #233)

karlcow created an issue (w3c/clipboard-apis#233)

With an input 

```
<!doctype html> <html> <head> <title>Title of the
                    document</title> </head> <body> <p>Hello World</p>
                    </body> </html>
```


All browsers return something different for `navigator.clipboard.write([clipboardItem]);`.



* FAIL Safari returns `<head> </head> <body> <p style=\"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;\">Hello World</p> </body>`
* PASS Firefox returns `<head> <title>Title of the document</title> </head> <body> <p>Hello World</p> </body>`
* FAIL Chrome returns `<head> <title>Title of the\n document</title> </head> <body> <p>Hello World</p> </body>`

The spec currently is not mandating what should the be the serialization, which in returns makes it difficult to test: 
https://github.com/web-platform-tests/wpt/issues/50744
https://github.com/web-platform-tests/wpt/commit/1023ea6944ea08595b5c4420747810c25d149d9d

Even if a strict canonical form was not required. 
It would be good to define what `.write()` means in the context of read/write operations. It is the exact copy of the data in read. is it the information visible to users (with another ambiguity about styling such as display: none element etc.)


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/233
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/issues/233@github.com>

Received on Friday, 21 February 2025 09:50:21 UTC