fix for #3141 - redirect from button() and buttonMarkup() to correct function for element

This commit is contained in:
Garann Means 2012-01-09 23:38:12 -06:00
parent 2ba27e0adc
commit c0dbecc855
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() )