diff --git a/core/misc/states.es6.js b/core/misc/states.es6.js index d55914f725..b324681a77 100644 --- a/core/misc/states.es6.js +++ b/core/misc/states.es6.js @@ -149,14 +149,14 @@ // Monitor state changes of the specified state for this dependee. let $dependee = $(selector); - $dependee.bind(`state:${state}`, { selector, state }, stateEventHandler); + $dependee.on(`state:${state}`, { selector, state }, stateEventHandler); // Make sure the event we just bound ourselves to is actually fired. new states.Trigger({ selector, state }); // Update initial state value, if set by data attribute. - if (typeof $dependee.data() !== 'undefined' && $dependee.data() !== null && $dependee.data().hasOwnProperty('trigger:' + state.name)) { - this.values[selector][state.name] = $dependee.data('trigger:' + state.name); + if ($dependee.data(`trigger:${state.name}`) !== undefined) { + this.values[selector][state.name] = $dependee.data(`trigger:${state.name}`); } } } @@ -376,7 +376,7 @@ // Only call the trigger initializer when it wasn't yet attached to this // element. Otherwise we'd end up with duplicate events. - if (typeof this.element.data() !== 'undefined' && this.element.data() !== null && !this.element.data().hasOwnProperty('trigger:' + this.state)) { + if (this.element.data(`trigger:${this.state}`) !== undefined) { this.initialize(); } }