vendor/assets/javascripts/base/_switch.js in active_frontend-14.0.86 vs vendor/assets/javascripts/base/_switch.js in active_frontend-14.0.87

- old
+ new

@@ -7,11 +7,15 @@ var Switch = function (element, options) { this.$element = $(element); this.settings = { baseClass: this.$element.data('base-class'), offClass: this.$element.data('off-class'), - onClass: this.$element.data('on-class') + onClass: this.$element.data('on-class'), + text: { + off: this.$element.data('text-off') || Switch.DEFAULTS.text.off, + on: this.$element.data('text-on') || Switch.DEFAULTS.text.on + } }; this.options = $.extend({}, Switch.DEFAULTS, this.settings, options); this.init(); }; @@ -68,11 +72,12 @@ Switch.prototype.on = function (silent) { if (this.$element.prop('disabled')) return false; this.$switch.removeClass('off'); this.$switch.addClass(this.options.onClass); - this.$element.prop('checked', true); + this.$element.prop('checked', true) + .attr('checked', 'checked'); if (!silent) this.trigger(); this.options.onOnCallback(); }; @@ -80,10 +85,11 @@ Switch.prototype.off = function (silent) { if (this.$element.prop('disabled')) return false; this.$switch.removeClass(this.options.onClass); this.$switch.addClass('off'); - this.$element.prop('checked', false); + this.$element.prop('checked', false) + .removeAttr('checked'); if (!silent) this.trigger(); this.options.onOffCallback(); };