diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-01-07 21:51:38 -0500 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-10-08 14:02:35 -0400 |
commit | 16abde399daa07e11f3b972ab675d59374cf08be (patch) | |
tree | df9f2ef654f5357ad1e7e1eac3ad6f79194b33f1 /ui | |
parent | 9f7f0a427966741a460e91336947698879f8ad77 (diff) | |
download | jquery-ui-16abde399daa07e11f3b972ab675d59374cf08be.tar.gz jquery-ui-16abde399daa07e11f3b972ab675d59374cf08be.zip |
Spinner: Updates for new button widget and classes option
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/button.js | 3 | ||||
-rw-r--r-- | ui/widgets/checkboxradio.js (renamed from ui/checkboxradio.js) | 46 | ||||
-rw-r--r-- | ui/widgets/spinner.js | 12 |
3 files changed, 19 insertions, 42 deletions
diff --git a/ui/widgets/button.js b/ui/widgets/button.js index 34a2afa40..2e6cc1f3c 100644 --- a/ui/widgets/button.js +++ b/ui/widgets/button.js @@ -12,8 +12,7 @@ //>>description: Enhances a form with themeable buttons. //>>docs: http://api.jqueryui.com/button/ //>>demos: http://jqueryui.com/button/ -//>>css.structure: ../themes/base/core.css -//>>css.structure: ../themes/base/button.css +//>>css.structure: ../themes/base/core.css, ../themes/base/button.css //>>css.theme: ../themes/base/theme.css ( function( factory ) { diff --git a/ui/checkboxradio.js b/ui/widgets/checkboxradio.js index 84f69afaa..781274b9b 100644 --- a/ui/checkboxradio.js +++ b/ui/widgets/checkboxradio.js @@ -14,8 +14,10 @@ // AMD. Register as an anonymous module. define( [ "jquery", - "./core", - "./widget" + "../escape-selector", + "../form-reset-mixin", + "../labels", + "../widget" ], factory ); } else { @@ -24,19 +26,7 @@ } }( function( $ ) { -// Remove and replace with reset handler extension -var formResetHandler = function() { - var form = $( this ); - - // Wait for the form reset to actually happen before refreshing - setTimeout( function() { - - // We dont filter for css only versions since css only is not supported - form.find( ".ui-checkboxradio" ).checkboxradio( "refresh" ); - } ); - }; - -$.widget( "ui.checkboxradio", { +$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { version: "@VERSION", options: { disabled: null, @@ -91,20 +81,12 @@ $.widget( "ui.checkboxradio", { }, _create: function() { - var formCount, - checked = this.element[ 0 ].checked, - form = this.element.form(); - this.formParent = !!form.length ? form : $( "body" ); - - formCount = this.formParent.data( "uiCheckboxradioCount" ) || 0; + var checked = this.element[ 0 ].checked; - // We don't use _on and _off here because we want all the checkboxes in the same form to use - // single handler which handles all the checkboxradio widgets in the form - if ( formCount === 0 ) { - this.formParent.on( "reset." + this.widgetFullName, formResetHandler ); - } + this._bindFormResetHandler(); - this.formParent.data( "uiCheckboxradioCount", formCount + 1 ); + // this.form is set by the form-reset-mixin + this.formParent = this.form.length ? this.form : $( "body" ); if ( this.options.disabled == null ) { this.options.disabled = this.element[ 0 ].disabled || false; @@ -199,13 +181,7 @@ $.widget( "ui.checkboxradio", { }, _destroy: function() { - var formCount = this.formParent.data( "uiCheckboxradioCount" ) - 1; - - this.formParent.data( "uiCheckboxradioCount", formCount ); - - if ( formCount === 0 ) { - this.formParent.off( "reset." + this.widgetFullName, formResetHandler ); - } + this._unbindFormResetHandler(); if ( this.icon ) { this.icon.remove(); @@ -282,7 +258,7 @@ $.widget( "ui.checkboxradio", { } } -} ); +} ] ); return $.ui.checkboxradio; diff --git a/ui/widgets/spinner.js b/ui/widgets/spinner.js index f79b2baed..3a0b6deef 100644 --- a/ui/widgets/spinner.js +++ b/ui/widgets/spinner.js @@ -250,17 +250,19 @@ $.widget( "ui.spinner", { // Button bindings this.buttons = this.uiSpinner.children( "a" ) .attr( "tabIndex", -1 ) - .button(); + .button( { + classes: { + "ui-button": "" + } + } ); // TODO: Right now button does not support classes this is already updated in button PR this._removeClass( this.buttons, "ui-corner-all" ); this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); - this._addClass( this.buttons.first().find( ".ui-button-text span" ), null, - "ui-icon " + this.options.icons.up ); - this._addClass( this.buttons.last().find( ".ui-button-text span" ), null, - "ui-icon " + this.options.icons.down ); + this.buttons.first().button( "option", "icon", this.options.icons.up ); + this.buttons.last().button( "option", "icon", this.options.icons.down ); // IE 6 doesn't understand height: 50% for the buttons // unless the wrapper has an explicit height |