Fullcalendar 无法访问 drop 中的 html5 数据属性,仅在 Firefox 上

Fullcalendar can't access html5 data attribute in drop, only on Firefox

我有完整的日历设置来从外部事件中获取 html5 数据属性 "event"。由于不需要进入的原因,我需要在 fullcalendar 的 drop 事件处理程序中访问该数据,但是当我使用 var foo = $(this).data(event); 时,它似乎在那时停止了脚本,但仅在 Firefox 中,并且控制台中没有错误显示。

Here 是一个显示它的 jsfiddle。出于某种原因,日历无法正常工作,但这不是我的问题。当您将事件放在日历上的任何位置时,问题就会显现出来。在 chrome 中,您将看到总共 3 个警告框。在 Firefox 中,只有两个。

你用错了方法。

.data()用于存储任意数据,

Store arbitrary data associated with the matched elements or return the value at the named data store for the first element in the set of matched elements.
[…]
The .data() method allows us to attach data of any type to DOM elements

这个"data store"与HTML5数据属性关系不大。

要阅读这些内容,您只需使用:$(this).attr('data-event')