diff options
Diffstat (limited to 'xstatic/pkg/jquery_ui/data/ui/jquery.ui.button.js')
-rw-r--r-- | xstatic/pkg/jquery_ui/data/ui/jquery.ui.button.js | 79 |
1 files changed, 28 insertions, 51 deletions
diff --git a/xstatic/pkg/jquery_ui/data/ui/jquery.ui.button.js b/xstatic/pkg/jquery_ui/data/ui/jquery.ui.button.js index 53cf699..e8d5544 100644 --- a/xstatic/pkg/jquery_ui/data/ui/jquery.ui.button.js +++ b/xstatic/pkg/jquery_ui/data/ui/jquery.ui.button.js @@ -1,8 +1,8 @@ /*! - * jQuery UI Button 1.9.2 + * jQuery UI Button 1.10.4 * http://jqueryui.com * - * Copyright 2012 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 ) { @@ -29,6 +28,7 @@ var lastActive, startXPos, startYPos, clickDragged, form = radio.form, radios = $( [] ); if ( name ) { + name = name.replace( /'/g, "\\'" ); if ( form ) { radios = $( form ).find( "[name='" + name + "']" ); } else { @@ -42,7 +42,7 @@ var lastActive, startXPos, startYPos, clickDragged, }; $.widget( "ui.button", { - version: "1.9.2", + version: "1.10.4", defaultElement: "<button>", options: { disabled: null, @@ -70,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()); @@ -103,55 +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; } - $( this ).toggleClass( "ui-state-active" ); - that.buttonElement.attr( "aria-pressed", that.element[0].checked ); }); } 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" ); @@ -192,7 +168,9 @@ $.widget( "ui.button", { $( this ).addClass( "ui-state-active" ); } }) - .bind( "keyup" + this.eventNamespace, function() { + // see #8559, we bind to blur here in case the button element loses + // focus between keydown and keyup, it would be left in an "active" state + .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() { $( this ).removeClass( "ui-state-active" ); }); @@ -259,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() ); @@ -272,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; } @@ -359,9 +336,9 @@ $.widget( "ui.button", { }); $.widget( "ui.buttonset", { - version: "1.9.2", + version: "1.10.4", options: { - items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)" + items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)" }, _create: function() { |