Implement Document.defaultView - fixes #4518

This commit is contained in:
Jim Hoskins 2015-01-03 11:51:05 -05:00
parent 141b5d038f
commit c10049327a
4 changed files with 18 additions and 3 deletions

View file

@ -994,6 +994,11 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
self.ready_state.get() self.ready_state.get()
} }
// https://html.spec.whatwg.org/multipage/browsers.html#dom-document-defaultview
fn DefaultView(self) -> Temporary<Window> {
Temporary::new(self.window)
}
global_event_handlers!() global_event_handlers!()
event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange) event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange)
} }

View file

@ -84,5 +84,8 @@ partial interface Document {
// special event handler IDL attributes that only apply to Document objects // special event handler IDL attributes that only apply to Document objects
[LenientThis] attribute EventHandler onreadystatechange; [LenientThis] attribute EventHandler onreadystatechange;
// user interaction
readonly attribute Window defaultView;
}; };
Document implements GlobalEventHandlers; Document implements GlobalEventHandlers;

View file

@ -0,0 +1,10 @@
<html>
<head>
<script src="harness.js"></script>
</head>
<body>
<script>
is(document.defaultView, window);
</script>
</body>
</html>

View file

@ -36,9 +36,6 @@
[Document interface: operation writeln(DOMString)] [Document interface: operation writeln(DOMString)]
expected: FAIL expected: FAIL
[Document interface: attribute defaultView]
expected: FAIL
[Document interface: attribute activeElement] [Document interface: attribute activeElement]
expected: FAIL expected: FAIL