aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpy <pylaurent1314@gmail.com>2014-04-08 17:06:17 +0800
committerlpy <pylaurent1314@gmail.com>2014-04-08 22:13:28 +0800
commit77941dc996ccf938e7e9638b24a985a4816b9c25 (patch)
treebbfd658f51ec520903c97f085be78a580aba7b99
parent7541b5752642a96a9f860f4115681af211c897e1 (diff)
downloadservo-77941dc996ccf938e7e9638b24a985a4816b9c25.tar.gz
servo-77941dc996ccf938e7e9638b24a985a4816b9c25.zip
Move Node.namespaceURI to Element.(fixes #2059)
-rw-r--r--src/components/script/dom/element.rs5
-rw-r--r--src/components/script/dom/node.rs6
-rw-r--r--src/components/script/dom/webidls/Element.webidl3
-rw-r--r--src/components/script/dom/webidls/Node.webidl4
4 files changed, 8 insertions, 10 deletions
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs
index 8299f516119..3caf5cca129 100644
--- a/src/components/script/dom/element.rs
+++ b/src/components/script/dom/element.rs
@@ -443,6 +443,11 @@ impl Element {
}
impl Element {
+ // http://dom.spec.whatwg.org/#dom-element-namespaceuri
+ pub fn NamespaceURI(&self) -> DOMString {
+ self.namespace.to_str().to_owned()
+ }
+
// http://dom.spec.whatwg.org/#dom-element-tagname
pub fn TagName(&self) -> DOMString {
self.tag_name.to_ascii_upper()
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs
index 77ca388be9e..eb259c4641d 100644
--- a/src/components/script/dom/node.rs
+++ b/src/components/script/dom/node.rs
@@ -1733,12 +1733,6 @@ impl Node {
false
}
- // http://dom.spec.whatwg.org/#dom-node-namespaceuri
- pub fn GetNamespaceURI(&self, abstract_self: &JS<Node>) -> Option<DOMString> {
- let element: Option<JS<Element>> = ElementCast::to(abstract_self);
- element.map(|element| element.get().namespace.to_str().to_owned())
- }
-
// http://dom.spec.whatwg.org/#dom-node-prefix
pub fn GetPrefix(&self) -> Option<DOMString> {
None
diff --git a/src/components/script/dom/webidls/Element.webidl b/src/components/script/dom/webidls/Element.webidl
index 2211fd5c887..aa0161204b0 100644
--- a/src/components/script/dom/webidls/Element.webidl
+++ b/src/components/script/dom/webidls/Element.webidl
@@ -18,10 +18,11 @@ interface Element : Node {
We haven't moved these from Node to Element like the spec wants.
[Throws]
- readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
*/
+ [Constant]
+ readonly attribute DOMString namespaceURI;
// Not [Constant] because it depends on which document we're in
[Pure]
readonly attribute DOMString tagName;
diff --git a/src/components/script/dom/webidls/Node.webidl b/src/components/script/dom/webidls/Node.webidl
index 2a13d6ab381..39555e1e0d8 100644
--- a/src/components/script/dom/webidls/Node.webidl
+++ b/src/components/script/dom/webidls/Node.webidl
@@ -79,11 +79,9 @@ interface Node : EventTarget {
// Mozilla-specific stuff
// These have been moved to Element in the spec.
- // If we move namespaceURI, prefix and localName to Element they should return
+ // If we move prefix and localName to Element they should return
// a non-nullable type.
[Constant]
- readonly attribute DOMString? namespaceURI;
- [Constant]
readonly attribute DOMString? prefix;
[Constant]
readonly attribute DOMString? localName;