@@ -8,7 +8,7 @@ define( [ "jquery", "./widgets/page" ], function( jQuery ) {
88//>>excludeEnd("jqmBuildExclude");
99( function ( $ , undefined ) {
1010
11- $ . mobile . page . prototype . options . degradeInputs = {
11+ $ . mobile . degradeInputs = {
1212 color : false ,
1313 date : false ,
1414 datetime : false ,
@@ -23,34 +23,29 @@ $.mobile.page.prototype.options.degradeInputs = {
2323 url : false ,
2424 week : false
2525} ;
26+ // Backcompat remove in 1.5
27+ $ . mobile . page . prototype . options . degradeInputs = $ . mobile . degradeInputs ;
2628
27- //auto self-init widgets
29+ // Auto self-init widgets
2830$ . mobile . degradeInputsWithin = function ( target ) {
2931
30- var $target = $ ( target ) ,
31- page = $ . mobile . closestPageData ( $target ) , options ;
32+ target = $ ( target ) ;
3233
33- if ( ! page ) {
34- return ;
35- }
36-
37- options = page . options ;
38-
39- // degrade inputs to avoid poorly implemented native functionality
40- $target . find ( "input" ) . not ( page . keepNativeSelector ( ) ) . each ( function ( ) {
41- var $this = $ ( this ) ,
34+ // Degrade inputs to avoid poorly implemented native functionality
35+ target . find ( "input" ) . not ( $ . mobile . page . prototype . keepNativeSelector ( ) ) . each ( function ( ) {
36+ var element = $ ( this ) ,
4237 type = this . getAttribute ( "type" ) ,
43- optType = options . degradeInputs [ type ] || "text" ,
38+ optType = $ . mobile . degradeInputs [ type ] || "text" ,
4439 html , hasType , findstr , repstr ;
4540
46- if ( options . degradeInputs [ type ] ) {
47- html = $ ( "<div>" ) . html ( $this . clone ( ) ) . html ( ) ;
41+ if ( $ . mobile . degradeInputs [ type ] ) {
42+ html = $ ( "<div>" ) . html ( element . clone ( ) ) . html ( ) ;
4843 // In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead
4944 hasType = html . indexOf ( " type=" ) > - 1 ;
5045 findstr = hasType ? / \s + t y p e = [ " ' ] ? \w + [ ' " ] ? / : / \/ ? > / ;
5146 repstr = " type=\"" + optType + "\" data-" + $ . mobile . ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" ) ;
5247
53- $this . replaceWith ( html . replace ( findstr , repstr ) ) ;
48+ element . replaceWith ( html . replace ( findstr , repstr ) ) ;
5449 }
5550 } ) ;
5651
0 commit comments