summaryrefslogtreecommitdiff
path: root/resources/jquery.ui/jquery.ui.button.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/jquery.ui/jquery.ui.button.js')
-rw-r--r--resources/jquery.ui/jquery.ui.button.js56
1 files changed, 39 insertions, 17 deletions
diff --git a/resources/jquery.ui/jquery.ui.button.js b/resources/jquery.ui/jquery.ui.button.js
index d318e3de..9a70a01d 100644
--- a/resources/jquery.ui/jquery.ui.button.js
+++ b/resources/jquery.ui/jquery.ui.button.js
@@ -1,9 +1,9 @@
/*
- * jQuery UI Button 1.8.2
+ * jQuery UI Button 1.8.11
*
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
*
* http://docs.jquery.com/UI/Button
*
@@ -11,12 +11,12 @@
* jquery.ui.core.js
* jquery.ui.widget.js
*/
-(function( $ ) {
+(function( $, undefined ) {
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 ui-button-text-only",
+ 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( event ) {
$( ":ui-button", event.target.form ).each(function() {
var inst = $( this ).data( "button" );
@@ -44,6 +44,7 @@ var lastActive,
$.widget( "ui.button", {
options: {
+ disabled: null,
text: true,
label: null,
icons: {
@@ -56,6 +57,10 @@ $.widget( "ui.button", {
.unbind( "reset.button" )
.bind( "reset.button", formResetHandler );
+ if ( typeof this.options.disabled !== "boolean" ) {
+ this.options.disabled = this.element.attr( "disabled" );
+ }
+
this._determineButtonType();
this.hasTitle = !!this.buttonElement.attr( "title" );
@@ -195,8 +200,16 @@ $.widget( "ui.button", {
if ( this.type === "checkbox" || this.type === "radio" ) {
// we don't search against the document in case the element
// is disconnected from the DOM
- this.buttonElement = this.element.parents().last()
- .find( "[for=" + this.element.attr("id") + "]" );
+ var ancestor = this.element.parents().filter(":last"),
+ labelSelector = "label[for=" + this.element.attr("id") + "]";
+ this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+ this.buttonElement = ancestor.filter( labelSelector );
+ if ( !this.buttonElement.length ) {
+ this.buttonElement = ancestor.find( labelSelector );
+ }
+ }
this.element.addClass( "ui-helper-hidden-accessible" );
var checked = this.element.is( ":checked" );
@@ -285,34 +298,43 @@ $.widget( "ui.button", {
.appendTo( buttonElement.empty() )
.text(),
icons = this.options.icons,
- multipleIcons = icons.primary && icons.secondary;
+ multipleIcons = icons.primary && icons.secondary,
+ buttonClasses = [];
+
if ( icons.primary || icons.secondary ) {
- buttonElement.addClass( "ui-button-text-icon" +
- ( multipleIcons ? "s" : "" ) );
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
+
if ( icons.primary ) {
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
}
+
if ( icons.secondary ) {
buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
}
+
if ( !this.options.text ) {
- buttonElement
- .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
- .removeClass( "ui-button-text-icons ui-button-text-icon" );
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
if ( !this.hasTitle ) {
buttonElement.attr( "title", buttonText );
}
}
} else {
- buttonElement.addClass( "ui-button-text-only" );
+ buttonClasses.push( "ui-button-text-only" );
}
+ buttonElement.addClass( buttonClasses.join( " " ) );
}
});
$.widget( "ui.buttonset", {
+ options: {
+ items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
+ },
+
_create: function() {
this.element.addClass( "ui-buttonset" );
- this._init();
},
_init: function() {
@@ -328,7 +350,7 @@ $.widget( "ui.buttonset", {
},
refresh: function() {
- this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
+ this.buttons = this.element.find( this.options.items )
.filter( ":ui-button" )
.button( "refresh" )
.end()