Implement Window#top.

This commit is contained in:
Ms2ger 2015-07-11 01:04:49 +02:00
parent 52e857dd7b
commit 8b45f9f51c
4 changed files with 10 additions and 10 deletions

View file

@ -442,6 +442,15 @@ impl<'a> WindowMethods for &'a Window {
self.parent().unwrap_or(self.Window())
}
// https://html.spec.whatwg.org/multipage/#dom-top
fn Top(self) -> Root<Window> {
let mut window = self.Window();
while let Some(parent) = window.parent() {
window = parent;
}
window
}
fn Performance(self) -> Root<Performance> {
self.performance.or_init(|| {
Performance::new(self, self.navigation_start,