1 (function( $, undefined ) {
3 $.mobile.page.prototype.options.degradeInputs = {
7 "datetime-local": false,
20 //auto self-init widgets
21 $.mobile.$document.bind( "pagecreate create", function( e ) {
23 var page = $.mobile.closestPageData( $( e.target ) ), options;
29 options = page.options;
31 // degrade inputs to avoid poorly implemented native functionality
32 $( e.target ).find( "input" ).not( page.keepNativeSelector() ).each(function() {
33 var $this = $( this ),
34 type = this.getAttribute( "type" ),
35 optType = options.degradeInputs[ type ] || "text";
37 if ( options.degradeInputs[ type ] ) {
38 var html = $( "<div>" ).html( $this.clone() ).html(),
39 // In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead
40 hasType = html.indexOf( " type=" ) > -1,
41 findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/,
42 repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" );
44 $this.replaceWith( html.replace( findstr, repstr ) );