aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hoskins <jim@jimhoskins.com>2015-01-03 11:51:05 -0500
committerJim Hoskins <jim@jimhoskins.com>2015-01-03 12:08:58 -0500
commitc10049327a391c8e7c6bd3f872a76c1bb57d6e8f (patch)
tree21295dbe497989abcb4b55e4020e8dd28234d041
parent141b5d038fad3c0c44a6f1b309b8ca9edea54580 (diff)
downloadservo-c10049327a391c8e7c6bd3f872a76c1bb57d6e8f.tar.gz
servo-c10049327a391c8e7c6bd3f872a76c1bb57d6e8f.zip
Implement Document.defaultView - fixes #4518
-rw-r--r--components/script/dom/document.rs5
-rw-r--r--components/script/dom/webidls/Document.webidl3
-rw-r--r--tests/content/test_document_defaultView.html10
-rw-r--r--tests/wpt/metadata/html/dom/interfaces.html.ini3
4 files changed, 18 insertions, 3 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 888796dcaee..30099bb1798 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -994,6 +994,11 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
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!()
event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange)
}
diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl
index 8d75f20a8f7..92b7f35c34b 100644
--- a/components/script/dom/webidls/Document.webidl
+++ b/components/script/dom/webidls/Document.webidl
@@ -84,5 +84,8 @@ partial interface Document {
// special event handler IDL attributes that only apply to Document objects
[LenientThis] attribute EventHandler onreadystatechange;
+
+ // user interaction
+ readonly attribute Window defaultView;
};
Document implements GlobalEventHandlers;
diff --git a/tests/content/test_document_defaultView.html b/tests/content/test_document_defaultView.html
new file mode 100644
index 00000000000..e5f6d36a433
--- /dev/null
+++ b/tests/content/test_document_defaultView.html
@@ -0,0 +1,10 @@
+<html>
+ <head>
+ <script src="harness.js"></script>
+ </head>
+ <body>
+ <script>
+ is(document.defaultView, window);
+ </script>
+ </body>
+</html>
diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini
index 0a0250c004f..f8fbde7b085 100644
--- a/tests/wpt/metadata/html/dom/interfaces.html.ini
+++ b/tests/wpt/metadata/html/dom/interfaces.html.ini
@@ -36,9 +36,6 @@
[Document interface: operation writeln(DOMString)]
expected: FAIL
- [Document interface: attribute defaultView]
- expected: FAIL
-
[Document interface: attribute activeElement]
expected: FAIL