Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error when set data in safari #948

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

shuizhongyueming
Copy link

@shuizhongyueming shuizhongyueming commented Apr 20, 2017

在IOS 10.3.1的Safari里面,尝试对原生DOM对象的dataset做delete操作,会报TypeError: Unable to delete property.。在StackOverflow上面也有类似的问题http://stackoverflow.com/questions/28973603/unable-to-delete-property-on-safari-when-trying-to-delete-dataset-attribute-in

仔细看了方法$.fn.data,在读取data的时候,优先取的__eleData,而写入的时候也会写入__eleData。所以if (key in tmpData) delete el.dataset[key];是多余的,而且tmpData里面有,不等于el.dataset[key]就一定有值的。

在IOS 10.3.1的Safari里面,尝试对原生DOM对象的dataset做delete操作,会报`TypeError: Unable to delete property.`

仔细看了方法`$.fn.data`,在读取data的时候,优先取的__eleData,而写入的时候也会写入__eleData。所以`if (key in tmpData) delete el.dataset[key];`是多余的,而且tmpData里面有,不等于el.dataset[key]就一定有值的。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant