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

Commit e6ff092

Browse files
committed
Page: deprecate setContainerBackground and removeContainerBackground move to content widget
1 parent c5372d1 commit e6ff092

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

js/jquery.mobile.navigation.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ define( [
1919
(function( $, undefined ) {
2020

2121
$.widget( "mobile.content", {
22+
options: {
23+
theme: "a"
24+
},
25+
2226
initSelector: false,
2327

2428
_create: function() {
@@ -52,6 +56,17 @@ define( [
5256
}, this));
5357
},
5458

59+
_setOptions: function( options ){
60+
if ( options.theme !== undefined && options.theme !== "none" ) {
61+
this.element.removeClass( "ui-overlay-" + this.options.theme )
62+
.addClass( "ui-overlay-" + options.theme );
63+
} else if ( options.theme !== undefined ) {
64+
this.element.removeClass( "ui-overlay-" + this.options.theme );
65+
}
66+
67+
this._super( options );
68+
},
69+
5570
_disableRecordScroll: function() {
5671
this.setLastScrollEnabled = false;
5772
},

js/widgets/page.js

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,33 +121,16 @@ $.widget( "mobile.page", {
121121
_handlePageBeforeShow: function(/* e */) {
122122
this.setContainerBackground();
123123
},
124-
124+
// Deprecated in 1.4 remove in 1.5
125125
removeContainerBackground: function() {
126-
var classes = ( $.mobile.pageContainer.attr( "class" ) || "" ).split( " " ),
127-
overlayTheme = null,
128-
matches;
129-
130-
while ( classes.length > 0 ) {
131-
overlayTheme = classes.pop();
132-
matches = ( new RegExp( "^ui-overlay-([a-z])$" ) ).exec( overlayTheme );
133-
if ( matches && matches.length > 1 ) {
134-
overlayTheme = matches[ 1 ];
135-
break;
136-
} else {
137-
overlayTheme = null;
138-
}
139-
}
140-
141-
$.mobile.pageContainer.removeClass( "ui-overlay-" + overlayTheme );
126+
this.element.closest( ":mobile-content" ).content({ "theme": "none" });
142127
},
143-
128+
// Deprecated in 1.4 remove in 1.5
144129
// set the page container background to the page theme
145130
setContainerBackground: function( theme ) {
146-
if ( this.options.theme ) {
147-
$.mobile.pageContainer.addClass( "ui-overlay-" + ( theme || this.options.theme ) );
148-
}
131+
this.element.parent().content( { "theme": theme || this.options.theme } );
149132
},
150-
133+
// Deprecated in 1.4 remove in 1.5
151134
keepNativeSelector: function() {
152135
var options = this.options,
153136
keepNativeDefined = options.keepNative && $.trim( options.keepNative );

0 commit comments

Comments
 (0)