diff --git a/js/jquery.mobile.buttonMarkup.js b/js/jquery.mobile.buttonMarkup.js index 3f910559..388b3f2e 100755 --- a/js/jquery.mobile.buttonMarkup.js +++ b/js/jquery.mobile.buttonMarkup.js @@ -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(); } diff --git a/js/jquery.mobile.forms.button.js b/js/jquery.mobile.forms.button.js index a418fabf..d15c5178 100644 --- a/js/jquery.mobile.forms.button.js +++ b/js/jquery.mobile.forms.button.js @@ -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 = $( "
" ) .text( $el.text() || $el.val() )