views:

486

answers:

1

When I do this in dragstart event:

e.dataTransfer.setData('text/plain', 'text');
e.dataTransfer.setData('text/html', 'html');
e.dataTransfer.setData('application/x-bookmark', 'bookmark');

and this in drop event:

for (var i = 0; i < e.dataTransfer.types.length; i++) {
   var type = e.dataTransfer.types[i];
   console.log(type + ":" + e.dataTransfer.getData(type));
}

I was supposed to have:

text/plain:text
text/html:html
application/x-bookmark:bookmark

as what I got in FF, but actually I got:

Text:text
text/plain:text

in Chrome. Where are those data gone? Does this mean chrome did not implement the dataTransfer object properly? And what can I do about this?

I ran this in Chrome 4.0.266.0

+1  A: 

Yes it is a bug in Chrome. See issues 31037 and issue 30240 in the chromium issue tracker (chromium is the open source version of google chrome). I see no other solution than waiting for the bug to be fixed. You can help them fixing it by providing a simple test case.

Fabian Jakobs