Bug 200569 - Copied table from Google Docs is stripped of metadata
Summary: Copied table from Google Docs is stripped of metadata
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 12
Hardware: Unspecified macOS 10.14
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-09 04:31 PDT by Comandeer
Modified: 2019-08-10 01:04 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Comandeer 2019-08-09 04:31:20 PDT
Steps to reproduce:

1. Open https://docs.google.com/document/d/1EdVmbZBsieJJryJfTuax2UI0zWAfTfo6dyXb1sfWChM/edit
2. Select all and copy.
3. Paste into https://jsfiddle.net/Comandeer/dnjsgk46/

The same content copied and pasted in Chrome and Firefox is correctly detected as content from Google Docs. However in Safari it's not. Safari seems to do some kind of normalization on copy and fixes incorrect HTML code provided by GDocs.

Content in Chrome: https://gist.github.com/Comandeer/397d9611684d6c5d6dc632cc0ee37b33
Content in Safari: https://gist.github.com/Comandeer/a947fcb4ff4ad0ac2ae5a599cde65655

As shown on the above example, Safari deletes the b element, which wraps the whole div with the table, resulting in loss of metadata (b[id] attribute).

Probably the bug is connected with https://bugs.webkit.org/show_bug.cgi?id=191836.
Comment 1 Radar WebKit Bug Importer 2019-08-09 22:47:34 PDT
<rdar://problem/54155334>
Comment 2 Ryosuke Niwa 2019-08-10 01:04:49 PDT
This is intentional sanitization. It's not safe in terms of security & privacy to expose raw clipboard content put forth by cross origin websites or native applications:
https://webkit.org/blog/8170/clipboard-api-improvements/