aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/script/dom/nodeiterator.rs35
-rw-r--r--src/components/script/dom/webidls/NodeFilter.webidl33
-rw-r--r--src/components/script/dom/webidls/NodeIterator.webidl32
-rw-r--r--src/components/script/script.rs1
-rw-r--r--src/test/content/test_interfaces.html1
5 files changed, 102 insertions, 0 deletions
diff --git a/src/components/script/dom/nodeiterator.rs b/src/components/script/dom/nodeiterator.rs
new file mode 100644
index 00000000000..f890f71cf4f
--- /dev/null
+++ b/src/components/script/dom/nodeiterator.rs
@@ -0,0 +1,35 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::bindings::codegen::Bindings::NodeIteratorBinding;
+use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{JSRef, Temporary};
+use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
+
+#[deriving(Encodable)]
+pub struct NodeIterator {
+ pub reflector_: Reflector
+}
+
+impl NodeIterator {
+ pub fn new_inherited() -> NodeIterator {
+ NodeIterator {
+ reflector_: Reflector::new()
+ }
+ }
+
+ pub fn new(global: &GlobalRef) -> Temporary<NodeIterator> {
+ reflect_dom_object(box NodeIterator::new_inherited(), global, NodeIteratorBinding::Wrap)
+ }
+}
+
+impl<'a> NodeIteratorMethods for JSRef<'a, NodeIterator> {
+}
+
+impl Reflectable for NodeIterator {
+ fn reflector<'a>(&'a self) -> &'a Reflector {
+ &self.reflector_
+ }
+}
diff --git a/src/components/script/dom/webidls/NodeFilter.webidl b/src/components/script/dom/webidls/NodeFilter.webidl
new file mode 100644
index 00000000000..b84b369829e
--- /dev/null
+++ b/src/components/script/dom/webidls/NodeFilter.webidl
@@ -0,0 +1,33 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * http://dom.spec.whatwg.org/#interface-nodefilter
+ */
+// Import form http://hg.mozilla.org/mozilla-central/file/a5a720259d79/dom/webidl/NodeFilter.webidl
+
+callback interface NodeFilter {
+ // Constants for acceptNode()
+ // const unsigned short FILTER_ACCEPT = 1;
+ // const unsigned short FILTER_REJECT = 2;
+ // const unsigned short FILTER_SKIP = 3;
+
+ // Constants for whatToShow
+ // const unsigned long SHOW_ALL = 0xFFFFFFFF;
+ // const unsigned long SHOW_ELEMENT = 0x1;
+ // const unsigned long SHOW_ATTRIBUTE = 0x2; // historical
+ // const unsigned long SHOW_TEXT = 0x4;
+ // const unsigned long SHOW_CDATA_SECTION = 0x8; // historical
+ // const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical
+ // const unsigned long SHOW_ENTITY = 0x20; // historical
+ // const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40;
+ // const unsigned long SHOW_COMMENT = 0x80;
+ // const unsigned long SHOW_DOCUMENT = 0x100;
+ // const unsigned long SHOW_DOCUMENT_TYPE = 0x200;
+ // const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400;
+ // const unsigned long SHOW_NOTATION = 0x800; // historical
+
+ unsigned short acceptNode(Node node);
+};
diff --git a/src/components/script/dom/webidls/NodeIterator.webidl b/src/components/script/dom/webidls/NodeIterator.webidl
new file mode 100644
index 00000000000..6eb684dd9f9
--- /dev/null
+++ b/src/components/script/dom/webidls/NodeIterator.webidl
@@ -0,0 +1,32 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * http://www.w3.org/TR/2012/WD-dom-20120105/
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+// Import from http://hg.mozilla.org/mozilla-central/raw-file/a5a720259d79/dom/webidl/NodeIterator.webidl
+
+interface NodeIterator {
+ // [Constant]
+ // readonly attribute Node root;
+ // [Pure]
+ // readonly attribute Node? referenceNode;
+ // [Pure]
+ // readonly attribute boolean pointerBeforeReferenceNode;
+ // [Constant]
+ // readonly attribute unsigned long whatToShow;
+ // [Constant]
+ // readonly attribute NodeFilter? filter;
+
+ // [Throws]
+ // Node? nextNode();
+ // [Throws]
+ // Node? previousNode();
+
+ // void detach();
+};
diff --git a/src/components/script/script.rs b/src/components/script/script.rs
index e390bd0d6df..134d032f635 100644
--- a/src/components/script/script.rs
+++ b/src/components/script/script.rs
@@ -173,6 +173,7 @@ pub mod dom {
pub mod mouseevent;
pub mod navigator;
pub mod node;
+ pub mod nodeiterator;
pub mod nodelist;
pub mod processinginstruction;
pub mod performance;
diff --git a/src/test/content/test_interfaces.html b/src/test/content/test_interfaces.html
index 3bf7c11d889..6f6d19c52cc 100644
--- a/src/test/content/test_interfaces.html
+++ b/src/test/content/test_interfaces.html
@@ -147,6 +147,7 @@ var interfaceNamesInGlobalScope = [
"MouseEvent",
"Navigator",
"Node",
+ "NodeIterator",
"NodeList",
"Performance",
"PerformanceTiming",