WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
135835
DragStart dataTransfer.setData clears (almost) all existing data
https://bugs.webkit.org/show_bug.cgi?id=135835
Summary
DragStart dataTransfer.setData clears (almost) all existing data
web
Reported
2014-08-12 03:17:18 PDT
Calling dataTransfer.setData(type, value) does not just append the data to the existing data, it also clears all existing data the dataTransfer object contained except for a "dyn." type. This breaks dragging e.g. an image with custom data meant for use within a webpage to e.g. Finder.app (as default image data is missing). Steps to reproduce: 1. Open any page and run the following code in the console: document.addEventListener('dragstart', function(e) { //e.dataTransfer.setData('text/x-test', 'Test') }) document.addEventListener('dragover', function(e) { e.preventDefault() }) document.addEventListener('drop', function(e) { e.preventDefault() console.log(e.dataTransfer.types) }) 2. Drag anything and drop on the same web page. Console will output an array with several data types (depending on what was dragged, but generally more than 10). 3. Run the following code in the console: document.addEventListener('dragstart', function(e) { e.dataTransfer.setData('text/x-test', 'Test') }) document.addEventListener('dragover', function(e) { e.preventDefault() }) document.addEventListener('drop', function(e) { e.preventDefault() console.log(e.dataTransfer.types) }) 4. Drag anything and drop on the same web page. Console will output an array with two values; "dyn."... and "text/x-test" (it will output these twice unless the page was refreshed). Expected result: Output in 4 having the same values as in 2 plus "text/x-test". As per
http://www.whatwg.org/specs/web-apps/current-work/multipage/interaction.html#dom-datatransfer-setdata
Actual result: Output in 4 having the just "text/x-test" and one more value.
Attachments
Add attachment
proposed patch, testcase, etc.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug