问题描述
简介:
大约在2017年3月中旬,在将Firefox更新至版本52之后,某些功能-拖放-正常运行。正如在调试中显示的那样,该事件的属性 dataTransfer如今已设置为null。
At about mid March 2017, after an update of firefox to version 52, certain functions - drop and paste - ceaced to function properly. As it shows up on debugging, the attribute "dataTransfer" of the event is nowadays set to null.
以前,在更新之前,onDrop和onPaste事件都提供了dataTransfer属性设置为要粘贴或粘贴的内容。
Previously to the update, onDrop and onPaste events both delivered the dataTransfer attribut set to the contents of what were to be dropped or pasted.
问题:
应如何粘贴用实际的浏览器处理?
这些天是否需要采取任何预防措施?
是否有解释当今限制性行为背后的原因?
How should drop and paste be handled with actual browsers?Are there any precautions necessary these days?Is there an explanation out there of the reasons behind the restrictive behavior of nowadays?
互联网上是否有任何示例说明如何完成任务
Is there any example out there in the internet showing how to accomplish the task with actual browsers?
我不要求使用firefox 48版本之前的示例,因为至少直到该版本之前,整个过程都可以正常工作。我不要求使用jQuery或任何其他库的示例(但如果它们是附加的补充,则不拒绝它们)。我确实要求使用简单的纯本地JavaScript进行示例。
I do not ask for examples prior to version 48 of firefox, since at least until that version, the whole thing worked flawlessly. I do not ask for examples with jQuery or any other library (while not rejecting those if they come as additional supplements). I do ask for examples with simple plain native javascript.
推荐答案
逐步调试时,dataTransfer中的数据似乎丢失了。可能是由于调试中涉及的事件。读取dataTransfer(ev.dataTransfer.getData)之后,开始逐步调试,您将看到dataTransfer不再为null。
When debugging step by step, the data from dataTransfer seems to get lost. Probably because of the events involved in debugging. Start the step-by-step debugging after the reading of dataTransfer (ev.dataTransfer.getData), and you will see that dataTransfer is not null anymore.
这篇关于更新到版本52后,firefox ondrop event.dataTransfer为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!