简体   繁体   English

html5拖放问题(数据集)

[英]html5 drag & drop problem (dataset)

Hi I'm just trying to implement some cool drag and drop stuff to my order form and I have problem with dataset js object. 嗨,我只是想在我的订单表单上实现一些很酷的拖放操作,而数据集js对象却有问题。 When I bind a function to an ondragstart event and then I try to read event.dataset.value, I get error TypeError: Result of expression 'event.target.dataset' [undefined] is not an object . 当我将函数绑定到ondragstart事件时,然后尝试读取event.dataset.value时,出现错误TypeError: Result of expression 'event.target.dataset' [undefined] is not an object When I log the event.target object into console, the dataset object is missing. 当我将event.target对象登录到控制台时,数据集对象丢失了。 The data attribute is only comprised in attributes object. 数据属性仅包含在属性对象中。 I am using Safari 5.0.5..In google chrome is everything ok. 我正在使用Safari 5.0.5 ..在Google Chrome中一切正常。 So is this stuff so bad and incosistently implemented? 那么,这些东西是如此糟糕并且难以实现吗? I thought, at least webkit browser should this handle well, but oposite seems true:) jQueryUI should fix it, but I wanted to rely on a non-plugin solution.. 我认为,至少Webkit浏览器应该可以很好地处理此问题,但相反的说法似乎是正确的:) jQueryUI应该修复它,但我想依靠一种非插件解决方案。

I think you're trying to pass a custom data set in the event. 我认为您正在尝试在事件中传递自定义数据集。

Would it be possible to pass the dataset along separately? 是否可以单独传递数据集? I don't know how well other browsers support modifying events at all. 我不知道其他浏览器完全支持修改事件。 I always stay well away from it. 我总是远离它。

jQuery wraps all events so you can extend them all you want. jQuery封装了所有事件,因此您可以扩展所有所需的事件。 That doesn't mean it's a very good approach :D 那并不意味着这是一个很好的方法:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM