Chrome是否不正确地实现dataTransfer对象? [英] Has Chrome improperly implemented the dataTransfer object?
问题描述
当我在dragstart事件中这样做时:
e.dataTransfer.setData('text / plain','text' );
e.dataTransfer.setData('text / html','html');
e.dataTransfer.setData('application / x-bookmark','bookmark');
,并且在drop事件中:
<$ p $ var $ type = e.dataTransfer.types [i]; $ p>
console.log(type +:+ e.dataTransfer.getData(type));
}
我应该有:
text / plain:text
p>
text / html:html
application / x-bookmark:bookmark
就像我在FF中得到的那样,但实际上我得到了:
<$在Chrome中使用c $ c> Text:text
text / plain:text
。这些数据在哪里去了?这是否意味着chrome没有正确实现dataTransfer对象?我能做些什么呢?
我在Chrome 4.0.266.0中运行了这个功能。
解决方案是的,它是Chrome中的一个错误。查看 31037 的问题,并发布 30240 中铬问题跟踪器(铬是谷歌浏览器的开源版本)。我没有看到其他的解决方案,只能等待bug修复。你可以通过提供一个简单的测试用例来帮助他们修复它。
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
解决方案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.
这篇关于Chrome是否不正确地实现dataTransfer对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!