Skip to content

Commit

Permalink
Prevent inputs with unnecessary data-role button from being double en…
Browse files Browse the repository at this point in the history
…hanced
  • Loading branch information
Josh Dean committed Jan 17, 2012
1 parent 956075c commit fcbc042
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/jquery.mobile.buttonMarkup.js
Expand Up @@ -30,6 +30,9 @@ $.fn.buttonMarkup = function( options ) {
buttonText = document.createElement( o.wrapperEls ),
buttonIcon = o.icon ? document.createElement( "span" ) : null;

// if so, prevent double enhancement, and continue with rest of the elements.
if( e.tagName === "INPUT" && e.getAttribute( "data-role" ) === "button" ) continue;

// 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();
Expand Down

0 comments on commit fcbc042

Please sign in to comment.