Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 17f0340

Browse files
author
scottjehl
committed
improved keepNative option so that it's additive on top of data-role=none and data-role=nojs.
1 parent bb5d247 commit 17f0340

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

js/jquery.mobile.page.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ $.widget( "mobile.page", $.mobile.widget, {
2525
url: false,
2626
week: false
2727
},
28-
keepNative: "[data-role='none'], .ui-nojs"
28+
keepNative: null
2929
},
3030

3131
_create: function() {
3232
var $elem = this.element,
33-
o = this.options;
33+
o = this.options;
34+
35+
this.keepNative = "[data-role='none'], [data-role='nojs']" + (o.keepNative ? ", " + o.keepNative : "");
3436

3537
if ( this._trigger( "beforeCreate" ) === false ) {
3638
return;
@@ -124,7 +126,7 @@ $.widget( "mobile.page", $.mobile.widget, {
124126
//links in bars, or those with data-role become buttons
125127
$elem.find( "[data-role='button'], .ui-bar a, .ui-header a, .ui-footer a" )
126128
.not( ".ui-btn" )
127-
.not(o.keepNative)
129+
.not(this.keepNative)
128130
.buttonMarkup();
129131

130132
$elem
@@ -133,7 +135,7 @@ $.widget( "mobile.page", $.mobile.widget, {
133135

134136
//links within content areas
135137
$elem.find( "a:not(.ui-btn):not(.ui-link-inherit)" )
136-
.not(o.keepNative)
138+
.not(this.keepNative)
137139
.addClass( "ui-link" );
138140

139141
//fix toolbars
@@ -144,7 +146,7 @@ $.widget( "mobile.page", $.mobile.widget, {
144146
var o = this.options;
145147

146148
// degrade inputs to avoid poorly implemented native functionality
147-
this.element.find( "input" ).not(o.keepNative).each(function() {
149+
this.element.find( "input" ).not(this.keepNative).each(function() {
148150
var type = this.getAttribute( "type" ),
149151
optType = o.degradeInputs[ type ] || "text";
150152

@@ -158,29 +160,29 @@ $.widget( "mobile.page", $.mobile.widget, {
158160
// enchance form controls
159161
this.element
160162
.find( "[type='radio'], [type='checkbox']" )
161-
.not(o.keepNative)
163+
.not(this.keepNative)
162164
.checkboxradio();
163165

164166
this.element
165167
.find( "button, [type='button'], [type='submit'], [type='reset'], [type='image']" )
166-
.not(o.keepNative)
168+
.not(this.keepNative)
167169
.button();
168170

169171
this.element
170172
.find( "input, textarea" )
171173
.not( "[type='radio'], [type='checkbox'], button, [type='button'], [type='submit'], [type='reset'], [type='image']" )
172-
.not(o.keepNative)
174+
.not(this.keepNative)
173175
.textinput();
174176

175177
this.element
176178
.find( "input, select" )
177-
.not(o.keepNative)
179+
.not(this.keepNative)
178180
.filter( "[data-role='slider'], [data-type='range']" )
179181
.slider();
180182

181183
this.element
182184
.find( "select:not([data-role='slider'])" )
183-
.not(o.keepNative)
185+
.not(this.keepNative)
184186
.selectmenu();
185187
}
186188
});

0 commit comments

Comments
 (0)