Restructured if/else's for better readability

This commit is contained in:
Giovanni Giacobbi 2011-03-20 03:19:36 +01:00
parent 6d01645716
commit 3ce8429f4f

View File

@ -183,21 +183,17 @@ $.widget( "ui.button", {
}, },
_determineButtonType: function() { _determineButtonType: function() {
if ( this.element.is(":checkbox") ) { if ( this.element.is(":checkbox") ) {
this.type = "checkbox"; this.type = "checkbox";
} else if ( this.element.is(":radio") ) {
this.type = "radio";
} else if ( this.element.is("input") ) {
this.type = "input";
} else { } else {
if ( this.element.is(":radio") ) { this.type = "button";
this.type = "radio";
} else {
if ( this.element.is("input") ) {
this.type = "input";
} else {
this.type = "button";
}
}
} }
if ( this.type === "checkbox" || this.type === "radio" ) { if ( this.type === "checkbox" || this.type === "radio" ) {
// we don't search against the document in case the element // we don't search against the document in case the element
// is disconnected from the DOM // is disconnected from the DOM