Skip to content
This repository
Browse code

changed $.inArray to indexOf in closestEnabledButton - see http://jsp…

  • Loading branch information...
commit f3f5ba62e542a987ea92c02f993a91beeb6c61d6 1 parent e918442
Hans-Peter Buniat authored November 20, 2011

Showing 1 changed file with 4 additions and 6 deletions. Show diff stats Hide diff stats

  1. 10  js/jquery.mobile.buttonMarkup.js
10  js/jquery.mobile.buttonMarkup.js 100644 → 100755
@@ -6,7 +6,6 @@
6 6
 
7 7
 $.fn.buttonMarkup = function( options ) {
8 8
 	options = options || {};
9  
-
10 9
 	for ( var i = 0; i < this.length; i++ ) {
11 10
 		var el = this.eq( i ),
12 11
 			e = el[ 0 ],
@@ -92,7 +91,7 @@ $.fn.buttonMarkup = function( options ) {
92 91
 		}
93 92
 
94 93
 		e.appendChild( buttonInner );
95  
-		
  94
+
96 95
 		// TODO obviously it would be nice to pull this element out instead of
97 96
 		// retrieving it from the DOM again, but this change is much less obtrusive
98 97
 		// and 1.0 draws nigh
@@ -118,12 +117,11 @@ function closestEnabledButton( element ) {
118 117
 		// handed could be in an SVG DOM where className on SVG elements is defined to
119 118
 		// be of a different type (SVGAnimatedString). We only operate on HTML DOM
120 119
 		// elements, so we look for plain "string".
121  
-
122  
-        cname = ( typeof element.className === 'string' ) && element.className.split(' ');
123  
-
124  
-        if ( cname && $.inArray( "ui-btn", cname ) > -1 && $.inArray( "ui-disabled", cname ) < 0 ) {
  120
+        cname = ( typeof element.className === 'string' ) && (element.className + ' ');
  121
+        if ( cname && cname.indexOf("ui-btn ") > -1 && cname.indexOf("ui-disabled ") < 0 ) {
125 122
             break;
126 123
         }
  124
+
127 125
         element = element.parentNode;
128 126
     }
129 127
 

0 notes on commit f3f5ba6

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