fix(dataset): check if property exist before deleting

in Safari, when it is `use strict`, if the dataset property is removed in DOM
deleting it again will cause an error

closes #309
pull/313/head
Churchill Lee 8 years ago
parent 7b45afea49
commit 06c9cfbb47
No known key found for this signature in database
GPG Key ID: 009EEF0BF3F174E1

@ -19,7 +19,7 @@ function updateDataset(oldVnode: VNode, vnode: VNode): void {
for (key in oldDataset) {
if (!dataset[key]) {
if (d) {
if (d && d[key]) {
delete d[key];
} else {
elm.removeAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase());
@ -38,4 +38,4 @@ function updateDataset(oldVnode: VNode, vnode: VNode): void {
}
export const datasetModule = {create: updateDataset, update: updateDataset} as Module;
export default datasetModule;
export default datasetModule;

Loading…
Cancel
Save