开发者

Has Chrome improperly implemented the dataTransfer object?

When I do this in dragstart event:

e.dataTransfer.setData('text/plain', 'text');
e.dataTransfer.setData('text/html', 'html');
e.dataTransfer.setData('application/x-bookma开发者_运维技巧rk', '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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜