diff options
Diffstat (limited to 'themes/default/js/ui/jquery.ui.button.js')
-rw-r--r-- | themes/default/js/ui/jquery.ui.button.js | 70 |
1 files changed, 23 insertions, 47 deletions
diff --git a/themes/default/js/ui/jquery.ui.button.js b/themes/default/js/ui/jquery.ui.button.js index 74c072b33..e8d5544ac 100644 --- a/themes/default/js/ui/jquery.ui.button.js +++ b/themes/default/js/ui/jquery.ui.button.js @@ -1,8 +1,8 @@ /*! - * jQuery UI Button 1.10.1 + * jQuery UI Button 1.10.4 * http://jqueryui.com * - * Copyright 2013 jQuery Foundation and other contributors + * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * @@ -14,14 +14,13 @@ */ (function( $, undefined ) { -var lastActive, startXPos, startYPos, clickDragged, +var lastActive, baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - stateClasses = "ui-state-hover ui-state-active ", typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", formResetHandler = function() { - var buttons = $( this ).find( ":ui-button" ); + var form = $( this ); setTimeout(function() { - buttons.button( "refresh" ); + form.find( ":ui-button" ).button( "refresh" ); }, 1 ); }, radioGroup = function( radio ) { @@ -43,7 +42,7 @@ var lastActive, startXPos, startYPos, clickDragged, }; $.widget( "ui.button", { - version: "1.10.1", + version: "1.10.4", defaultElement: "<button>", options: { disabled: null, @@ -71,8 +70,7 @@ $.widget( "ui.button", { var that = this, options = this.options, toggleButton = this.type === "checkbox" || this.type === "radio", - activeClass = !toggleButton ? "ui-state-active" : "", - focusClass = "ui-state-focus"; + activeClass = !toggleButton ? "ui-state-active" : ""; if ( options.label === null ) { options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); @@ -104,53 +102,32 @@ $.widget( "ui.button", { } }); - this.element - .bind( "focus" + this.eventNamespace, function() { - // no need to check disabled, focus won't be triggered anyway - that.buttonElement.addClass( focusClass ); - }) - .bind( "blur" + this.eventNamespace, function() { - that.buttonElement.removeClass( focusClass ); - }); + // Can't use _focusable() because the element that receives focus + // and the element that gets the ui-state-focus class are different + this._on({ + focus: function() { + this.buttonElement.addClass( "ui-state-focus" ); + }, + blur: function() { + this.buttonElement.removeClass( "ui-state-focus" ); + } + }); if ( toggleButton ) { this.element.bind( "change" + this.eventNamespace, function() { - if ( clickDragged ) { - return; - } that.refresh(); }); - // if mouse moves between mousedown and mouseup (drag) set clickDragged flag - // prevents issue where button state changes but checkbox/radio checked state - // does not in Firefox (see ticket #6970) - this.buttonElement - .bind( "mousedown" + this.eventNamespace, function( event ) { - if ( options.disabled ) { - return; - } - clickDragged = false; - startXPos = event.pageX; - startYPos = event.pageY; - }) - .bind( "mouseup" + this.eventNamespace, function( event ) { - if ( options.disabled ) { - return; - } - if ( startXPos !== event.pageX || startYPos !== event.pageY ) { - clickDragged = true; - } - }); } if ( this.type === "checkbox" ) { this.buttonElement.bind( "click" + this.eventNamespace, function() { - if ( options.disabled || clickDragged ) { + if ( options.disabled ) { return false; } }); } else if ( this.type === "radio" ) { this.buttonElement.bind( "click" + this.eventNamespace, function() { - if ( options.disabled || clickDragged ) { + if ( options.disabled ) { return false; } $( this ).addClass( "ui-state-active" ); @@ -260,7 +237,7 @@ $.widget( "ui.button", { this.element .removeClass( "ui-helper-hidden-accessible" ); this.buttonElement - .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) + .removeClass( baseClasses + " ui-state-active " + typeClasses ) .removeAttr( "role" ) .removeAttr( "aria-pressed" ) .html( this.buttonElement.find(".ui-button-text").html() ); @@ -273,10 +250,9 @@ $.widget( "ui.button", { _setOption: function( key, value ) { this._super( key, value ); if ( key === "disabled" ) { + this.element.prop( "disabled", !!value ); if ( value ) { - this.element.prop( "disabled", true ); - } else { - this.element.prop( "disabled", false ); + this.buttonElement.removeClass( "ui-state-focus" ); } return; } @@ -360,7 +336,7 @@ $.widget( "ui.button", { }); $.widget( "ui.buttonset", { - version: "1.10.1", + version: "1.10.4", options: { items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)" }, |