Skip to content
This repository
Browse code

fixes #3141 - redirect from button() and buttonMarkup() to correct fu…

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

0 notes on commit f0849af

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