Bug 191836 - Content pasted from Excel does not preserve its structure
Summary: Content pasted from Excel does not preserve its structure
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-19 06:41 PST by Comandeer
Modified: 2019-08-10 01:05 PDT (History)
4 users (show)

See Also:


Attachments
Excel file used for tests (8.40 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2018-11-19 06:41 PST, Comandeer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Comandeer 2018-11-19 06:41:03 PST
Created attachment 355278 [details]
Excel file used for tests

Content from Excel pasted into [contenteditable] area has all metadata stripped off, making it impossible to detect the source of the content.

In Safari only the table element is available in DataTransfer object: https://gist.github.com/Comandeer/e0226ec9908a6a1fdf9b0204eacfa84f
In case of Firefox and Chrome, the whole structure of HTML is preserved: https://gist.github.com/Comandeer/8909ffa0c93caadc88220f91ab72ad88

As it can be seen, Chrome and Firefox gives access to the whole HTML document, allowing to fetch metadata from its head section. Safari however gives access only to body section, which disables the ability to fetch useful metadata (e.g. about the generator of content or the author) and additional styles.
Comment 1 Radar WebKit Bug Importer 2018-11-19 17:43:20 PST
<rdar://problem/46175988>
Comment 2 Ryosuke Niwa 2019-08-10 01:05:19 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/