Merge pull request #3398 from garann/master

fix for duplicate/incorrect enhancement of buttons
This commit is contained in:
Mat Marquis 2012-01-16 15:04:56 -08:00
commit 2c34b82e69
2 changed files with 13 additions and 1 deletions

View file

@ -30,6 +30,12 @@ $.fn.buttonMarkup = function( options ) {
buttonText = document.createElement( o.wrapperEls ),
buttonIcon = o.icon ? document.createElement( "span" ) : null;
// if this is a button, check if it's been enhanced and, if not, use the right function
if( e.tagName === "BUTTON" ) {
if ( !$( e.parentNode ).hasClass( "ui-btn" ) ) $( e ).button();
continue;
}
if ( attachEvents ) {
attachEvents();
}

View file

@ -19,12 +19,18 @@ $.widget( "mobile.button", $.mobile.widget, {
},
_create: function() {
var $el = this.element,
$button,
$button,
o = this.options,
type,
name,
$buttonPlaceholder;
// if this is a link, check if it's been enhanced and, if not, use the right function
if( $el[ 0 ].tagName === "A" ) {
if ( !$el.hasClass( "ui-btn" ) ) $el.buttonMarkup();
return;
}
// Add ARIA role
this.button = $( "<div></div>" )
.text( $el.text() || $el.val() )