diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-04-10 00:32:01 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-04-10 00:32:01 +0200 |
commit | 2411d607d4dd1f213a1f1e541fb9b660515eb9a6 (patch) | |
tree | 4d7f16fc82d27881f96a6126b21c923e90a426c3 /components/script/dom | |
parent | 51dd6984f7cc292d77b2330d404ffcff34981214 (diff) | |
download | servo-2411d607d4dd1f213a1f1e541fb9b660515eb9a6.tar.gz servo-2411d607d4dd1f213a1f1e541fb9b660515eb9a6.zip |
Cleanup ProcessingInstruction
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/node.rs | 4 | ||||
-rw-r--r-- | components/script/dom/processinginstruction.rs | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 89ec44718eb..d624af38a59 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -38,7 +38,7 @@ use dom::element::ElementHelpers; use dom::eventtarget::{EventTarget, EventTargetTypeId}; use dom::htmlelement::HTMLElementTypeId; use dom::nodelist::NodeList; -use dom::processinginstruction::ProcessingInstruction; +use dom::processinginstruction::{ProcessingInstruction, ProcessingInstructionHelpers}; use dom::text::Text; use dom::virtualmethods::{VirtualMethods, vtable_for}; use dom::window::{Window, WindowHelpers}; @@ -1634,7 +1634,7 @@ impl Node { }, NodeTypeId::ProcessingInstruction => { let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap(); - let pi = ProcessingInstruction::new(pi.target().clone(), + let pi = ProcessingInstruction::new(pi.Target(), CharacterDataCast::from_ref(pi).Data(), document.r()); NodeCast::from_temporary(pi) }, diff --git a/components/script/dom/processinginstruction.rs b/components/script/dom/processinginstruction.rs index c9d102b9862..7eeb1a7e460 100644 --- a/components/script/dom/processinginstruction.rs +++ b/components/script/dom/processinginstruction.rs @@ -37,13 +37,20 @@ impl ProcessingInstruction { Node::reflect_node(box ProcessingInstruction::new_inherited(target, data, document), document, ProcessingInstructionBinding::Wrap) } +} + +pub trait ProcessingInstructionHelpers<'a> { + fn target(self) -> &'a DOMString; +} - pub fn target<'a>(&'a self) -> &'a DOMString { - &self.target +impl<'a> ProcessingInstructionHelpers<'a> for JSRef<'a, ProcessingInstruction> { + fn target(self) -> &'a DOMString { + &self.extended_deref().target } } impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> { + // https://dom.spec.whatwg.org/#dom-processinginstruction-target fn Target(self) -> DOMString { self.target.clone() } |