diff options
-rw-r--r-- | components/script/dom/node.rs | 4 | ||||
-rw-r--r-- | components/script/dom/processinginstruction.rs | 11 | ||||
-rw-r--r-- | components/script/parse/html.rs | 1 |
3 files changed, 12 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() } diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs index d3e6b981783..7509fd5d447 100644 --- a/components/script/parse/html.rs +++ b/components/script/parse/html.rs @@ -25,6 +25,7 @@ use dom::htmlscriptelement::HTMLScriptElementHelpers; use dom::node::{Node, NodeHelpers, NodeTypeId}; use dom::node::{document_from_node, window_from_node}; use dom::processinginstruction::ProcessingInstruction; +use dom::processinginstruction::ProcessingInstructionHelpers; use dom::servohtmlparser; use dom::servohtmlparser::{ServoHTMLParser, FragmentContext}; use dom::text::Text; |