firefox ondrop event.dataTransfer 更新到版本 52 后为空

时间:2023-04-29
本文介绍了firefox ondrop event.dataTransfer 更新到版本 52 后为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

简介:

大约在 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不再为空了.

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.

这篇关于firefox ondrop event.dataTransfer 更新到版本 52 后为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:在 Animate CC 2017 中使用 easeljs 拖放 下一篇:如何从一个 HTML5 画布拖放到另一个

相关文章

最新文章