Making tslint happy.

This commit is contained in:
Hristo Deshev
2015-08-07 10:45:42 +03:00
parent c5608d7c5c
commit a526e6cec8
2 changed files with 8 additions and 5 deletions

View File

@ -57,15 +57,17 @@ export function eachDescendant(view: definition.View, callback: (child: View) =>
export function getAncestor(view: View, criterion: string | Function): definition.View { export function getAncestor(view: View, criterion: string | Function): definition.View {
let matcher: (view: definition.View) => boolean = null; let matcher: (view: definition.View) => boolean = null;
if (typeof criterion === "string") if (typeof criterion === "string") {
matcher = (view: definition.View) => view.typeName === criterion; matcher = (view: definition.View) => view.typeName === criterion;
else } else {
matcher = (view: definition.View) => view instanceof criterion; matcher = (view: definition.View) => view instanceof criterion;
}
for (let parent: definition.View = view.parent; parent != null; parent = parent.parent) { for (let parent: definition.View = view.parent; parent != null; parent = parent.parent) {
if (matcher(parent)) if (matcher(parent)) {
return parent; return parent;
} }
}
return null; return null;
} }
@ -337,8 +339,9 @@ export class View extends proxy.ProxyObject implements definition.View {
} }
get page(): definition.View { get page(): definition.View {
if (this.parent) if (this.parent) {
return this.parent.page; return this.parent.page;
}
return null; return null;
} }