Skip to content

Commit

Permalink
fix for jquery-archive#3141 - redirect from button() and buttonMarkup…
Browse files Browse the repository at this point in the history
…() to correct function for element
  • Loading branch information
garann committed Jan 10, 2012
1 parent 2ba27e0 commit c0dbecc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions js/jquery.mobile.buttonMarkup.js
Expand Up @@ -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();
}
Expand Down
8 changes: 7 additions & 1 deletion js/jquery.mobile.forms.button.js
Expand Up @@ -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() )
Expand Down

0 comments on commit c0dbecc

Please sign in to comment.