14

当我在 dragstart 事件中执行此操作时:

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

这在下降事件中:

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

我应该有:

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

正如我在FF中得到的,但实际上我得到了:

Text:text
text/plain:text

在铬。那些数据去哪儿了?这是否意味着 chrome 没有正确实现 dataTransfer 对象?我能做些什么呢?

我在 Chrome 4.0.266.0 中运行了这个

4

1 回答 1

8

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.

于 2010-01-06T12:10:30.393 回答