event.clipboardData.setData() only uses last data type that was set

Issue #14080506 • Assigned to Steven K.

Details

Author
Lucas G.
Created
Oct 4, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

<script>
document.addEventListener("copy", function(e) {
// The first data type is ignored.
e.clipboardData.setData("text/html", “<b>markup</b> text”);
// The last one ends up on the clipboard.
e.clipboardData.setData("text/plain", “plain text”);
e.preventDefault();
});
function f() {
console.log(document.execCommand(“copy”));
}
</script>
<button onclick="f()">Button</button>
<div class="editable"></div>

If you paste this into a rich text field (like the editable div), only the plain text appears.
After copying the same way in all other browsers, the rich text appears. See the attached table.

Also see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14080262/

Attachments

Comments and activity

You need to sign in to your Microsoft account to add a comment.

Sign in