Using DataTransfer object’s setData and async clipboard write method, there are interop differences in how the HTML content is sanitized and written to the clipboard. The Async clipboard writer API uses sanitizers to strip out content such as `<head>`, `<meta>`, `<style>`, `<script>` tags from the HTML and inline styles into the markup. In this proposal, writing to the clipboard for `text/html` MIME type using the navigator.clipboard.write() API will write a higher fidelity sanitized, well-formed HTML markup instead of a more strictly sanitized HTML fragment. It will also preserve the tags such as `<meta>`, `<style>`, `<head>` etc that were stripped out by the fragment parser. Roundtripping of HTML content using the async clipboard API within the web doesn’t change as the async clipboard read() method still produces a sanitized HTML fragment.
HTML content is essential for supporting copy/paste operation of high-fidelity content from web sites to native apps and vice versa, especially in sites supporting document editing. Using DataTransfer object’s setData and async clipboard write method, there are interop differences in how the HTML content is sanitized and written to the clipboard. The Async clipboard writer API uses sanitizers to strip out content such as `<head>`, `<meta>`, `<style>`, `<script>` tags from the HTML and inline styles into the markup. In this proposal, writing to the clipboard for `text/html` MIME type using the navigator.clipboard.write() API will write a higher fidelity sanitized, well-formed HTML markup instead of a more strictly sanitized HTML fragment. It will also preserve the tags such as `<meta>`, `<style>`, `<head>` etc that were stripped out by the fragment parser.
Docs: https://docs.google.com/document/d/1rTEg2I-hMPXGiLrEMqKJz2Ycu6GRjlM3uvakOe84m8Q/edit?usp=sharing
Samples: https://github.com/w3c/editing/blob/gh-pages/docs/clipboard-unsanitized/unsanitized-html-demo.html