mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Fixes #2490 where IE (and WP7) were not properly degrading form inputs via the degradeinputs plugin (and search inputs were not being styled as such)
This commit is contained in:
parent
adc1ecc2e6
commit
b2d023732a
1 changed files with 7 additions and 4 deletions
|
|
@ -39,10 +39,13 @@ $( document ).bind( "pagecreate enhance", function( e ){
|
|||
optType = o.degradeInputs[ type ] || "text";
|
||||
|
||||
if ( o.degradeInputs[ type ] ) {
|
||||
$this.replaceWith(
|
||||
$( "<div>" ).html( $this.clone() ).html()
|
||||
.replace( /\s+type=["']?\w+['"]?/, " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\" " )
|
||||
);
|
||||
var html = $( "<div>" ).html( $this.clone() ).html(),
|
||||
// In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead
|
||||
hasType = html.indexOf( " type=" ) > -1,
|
||||
findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/,
|
||||
repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" );
|
||||
|
||||
$this.replaceWith( html.replace( findstr, repstr ) );
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue