Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge <17 doesn't write out proper CF_HTML #73

Closed
zbjornson opened this issue Jan 11, 2018 · 3 comments
Closed

Edge <17 doesn't write out proper CF_HTML #73

zbjornson opened this issue Jan 11, 2018 · 3 comments

Comments

@zbjornson
Copy link

FYI on a compatibility issue... Calling clipboardData.setData("text/html", data) writes the data argument verbatim in Edge 16.16299 and earlier. That means your "DOM node" test results in the clipboard containing this (according to a low-level clipboard inspector):

<span xmlns="http://www.w3.org/1999/xhtml" id="markup-dom-copy-source" style="font-family: Helvetica;"><i><span style="font-size: 150%">T</span>his</i> <span style="background: orange; padding: 0px 2px">will be</span> <b>copied</b>.</span>

which isn't valid CF_HTML.

Chrome does it correctly:

Version:0.9
StartHTML:0000000105
EndHTML:0000000416
StartFragment:0000000141
EndFragment:0000000380
<html>
<body>
<!--StartFragment--><span xmlns="http://www.w3.org/1999/xhtml" id="markup-dom-copy-source" style="font-family: Helvetica;"><i><span style="font-size: 150%">T</span>his</i> <span style="background: orange; padding: 0px 2px">will be</span> <b>copied</b>.</span><!--EndFragment-->
</body>
</html>

as does FF:

Version:0.9
StartHTML:00000097
EndHTML:00000406
StartFragment:00000131
EndFragment:00000370
<html><body>
<!--StartFragment--><span xmlns="http://www.w3.org/1999/xhtml" id="markup-dom-copy-source" style="font-family: Helvetica;"><i><span style="font-size: 150%">T</span>his</i> <span style="background: orange; padding: 0px 2px">will be</span> <b>copied</b>.</span><!--EndFragment-->
</body>
</html>

FWIW, I think these are the relevant bits of FF's and Chrome's source that writes the CF_HTML format: https://dxr.mozilla.org/mozilla-central/source/widget/windows/nsDataObj.cpp#1927, https://cs.chromium.org/chromium/src/ui/base/clipboard/clipboard_util_win.cc?q=StartFragment&sq=package:chromium&dr=C&l=380.

It looks like this will be fixed in Edge 17, https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14372529/, so maybe a wontfix here.

(Cool library btw!)

@lgarron
Copy link
Owner

lgarron commented Jan 12, 2018

Thanks! I should add that to the caveats and the experiment table.

This seems to specific only to Windows; is that correct?
What's a good way for me to inspect the full clipboard contents on Windows to check something like this (e.g. what's your low-level clipboard inspector)?

@zbjornson
Copy link
Author

Yep, specific to Windows.

I use http://www.peterbuettner.de/develop/tools/clipview/ to inspect the clipboard.

lgarron added a commit that referenced this issue Feb 9, 2018
lgarron added a commit that referenced this issue Feb 9, 2018
@lgarron lgarron closed this as completed in 432ba7c Feb 9, 2018
lgarron added a commit that referenced this issue Feb 9, 2018
@lgarron
Copy link
Owner

lgarron commented Feb 9, 2018

Actually, let's reopen this. Since it is a goal of this library to provide as much compatibility as is possible to polyfill, we may want to write CF_HTML manually for Edge UAs less than 17. I probably won't do it myself, but I'm happy to accept a PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants