Fix disappearing list item styles when navigating back to a page.

Do not clear style scope on unload event. Do it when removing child
views instead.
This commit is contained in:
Hristo Deshev
2017-03-14 15:34:03 +02:00
committed by Hristo Deshev
parent 3ea7365871
commit 308fa55e02

View File

@ -240,8 +240,6 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
} }
public onUnloaded() { public onUnloaded() {
this._styleScope = null;
this._setCssState(null);
this._unloadEachChild(); this._unloadEachChild();
this._isLoaded = false; this._isLoaded = false;
this._emit("unloaded"); this._emit("unloaded");
@ -261,6 +259,8 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
const scope = this._styleScope; const scope = this._styleScope;
if (scope) { if (scope) {
scope.applySelectors(this); scope.applySelectors(this);
} else {
this._setCssState(null);
} }
} }
@ -540,6 +540,9 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
*/ */
public _removeViewCore(view: ViewBase) { public _removeViewCore(view: ViewBase) {
// TODO: Discuss this. // TODO: Discuss this.
if (this._styleScope === view._styleScope) {
view._setStyleScope(null);
}
if (view.isLoaded) { if (view.isLoaded) {
view.onUnloaded(); view.onUnloaded();
} }