diff --git a/misc/states.js b/misc/states.js index 1d40273..2f3ca73 100644 --- a/misc/states.js +++ b/misc/states.js @@ -117,7 +117,7 @@ states.Dependent.prototype = { new states.Trigger({ selector: selector, state: state }); // Update initial state value, if set by data attribute. - if ($dependee.data() !== null && $dependee.data().hasOwnProperty('trigger:' + state.name)) { + if (typeof $dependee.data() !== 'undefined' && $dependee.data() !== null && $dependee.data().hasOwnProperty('trigger:' + state.name)) { this.values[selector][state.name] = $dependee.data('trigger:' + state.name); } } @@ -316,7 +316,7 @@ states.Trigger = function (args) { // Only call the trigger initializer when it wasn't yet attached to this // element. Otherwise we'd end up with duplicate events. - if (this.element.data() !== null && !this.element.data().hasOwnProperty('trigger:' + this.state)) { + if (typeof this.element.data() !== 'undefined' && this.element.data() !== null && !this.element.data().hasOwnProperty('trigger:' + this.state)) { this.initialize(); } }