Skip to content
This repository
Browse code

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

…function for element
  • Loading branch information...
commit c0dbecc8558b2ab08e7938aeeab29a6e368f1acc 1 parent 2ba27e0
Garann Means authored
6  js/jquery.mobile.buttonMarkup.js
@@ -30,6 +30,12 @@ $.fn.buttonMarkup = function( options ) {
30 30
 			buttonText = document.createElement( o.wrapperEls ),
31 31
 			buttonIcon = o.icon ? document.createElement( "span" ) : null;
32 32
 
  33
+		// if this is a button, check if it's been enhanced and, if not, use the right function
  34
+		if( e.tagName === "BUTTON" ) {
  35
+	 	 	if ( !$( e.parentNode ).hasClass( "ui-btn" ) ) $( e ).button();
  36
+	 	 	continue;
  37
+ 	 	}
  38
+
33 39
 		if ( attachEvents ) {
34 40
 			attachEvents();
35 41
 		}
8  js/jquery.mobile.forms.button.js
@@ -19,12 +19,18 @@ $.widget( "mobile.button", $.mobile.widget, {
19 19
 	},
20 20
 	_create: function() {
21 21
 		var $el = this.element,
22  
-            $button,
  22
+			$button,
23 23
 			o = this.options,
24 24
 			type,
25 25
 			name,
26 26
 			$buttonPlaceholder;
27 27
 
  28
+		// if this is a link, check if it's been enhanced and, if not, use the right function
  29
+		if( $el[ 0 ].tagName === "A" ) {
  30
+	 	 	if ( !$el.hasClass( "ui-btn" ) ) $el.buttonMarkup();
  31
+	 	 	return;
  32
+ 	 	}
  33
+
28 34
 		// Add ARIA role
29 35
 		this.button = $( "<div></div>" )
30 36
 			.text( $el.text() || $el.val() )

0 notes on commit c0dbecc

Please sign in to comment.
Something went wrong with that request. Please try again.