mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Cleanup ProcessingInstruction
This commit is contained in:
parent
51dd6984f7
commit
2411d607d4
3 changed files with 12 additions and 4 deletions
|
@ -38,7 +38,7 @@ use dom::element::ElementHelpers;
|
||||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||||
use dom::htmlelement::HTMLElementTypeId;
|
use dom::htmlelement::HTMLElementTypeId;
|
||||||
use dom::nodelist::NodeList;
|
use dom::nodelist::NodeList;
|
||||||
use dom::processinginstruction::ProcessingInstruction;
|
use dom::processinginstruction::{ProcessingInstruction, ProcessingInstructionHelpers};
|
||||||
use dom::text::Text;
|
use dom::text::Text;
|
||||||
use dom::virtualmethods::{VirtualMethods, vtable_for};
|
use dom::virtualmethods::{VirtualMethods, vtable_for};
|
||||||
use dom::window::{Window, WindowHelpers};
|
use dom::window::{Window, WindowHelpers};
|
||||||
|
@ -1634,7 +1634,7 @@ impl Node {
|
||||||
},
|
},
|
||||||
NodeTypeId::ProcessingInstruction => {
|
NodeTypeId::ProcessingInstruction => {
|
||||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
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());
|
CharacterDataCast::from_ref(pi).Data(), document.r());
|
||||||
NodeCast::from_temporary(pi)
|
NodeCast::from_temporary(pi)
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,13 +37,20 @@ impl ProcessingInstruction {
|
||||||
Node::reflect_node(box ProcessingInstruction::new_inherited(target, data, document),
|
Node::reflect_node(box ProcessingInstruction::new_inherited(target, data, document),
|
||||||
document, ProcessingInstructionBinding::Wrap)
|
document, ProcessingInstructionBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn target<'a>(&'a self) -> &'a DOMString {
|
pub trait ProcessingInstructionHelpers<'a> {
|
||||||
&self.target
|
fn target(self) -> &'a DOMString;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ProcessingInstructionHelpers<'a> for JSRef<'a, ProcessingInstruction> {
|
||||||
|
fn target(self) -> &'a DOMString {
|
||||||
|
&self.extended_deref().target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> {
|
impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> {
|
||||||
|
// https://dom.spec.whatwg.org/#dom-processinginstruction-target
|
||||||
fn Target(self) -> DOMString {
|
fn Target(self) -> DOMString {
|
||||||
self.target.clone()
|
self.target.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ use dom::htmlscriptelement::HTMLScriptElementHelpers;
|
||||||
use dom::node::{Node, NodeHelpers, NodeTypeId};
|
use dom::node::{Node, NodeHelpers, NodeTypeId};
|
||||||
use dom::node::{document_from_node, window_from_node};
|
use dom::node::{document_from_node, window_from_node};
|
||||||
use dom::processinginstruction::ProcessingInstruction;
|
use dom::processinginstruction::ProcessingInstruction;
|
||||||
|
use dom::processinginstruction::ProcessingInstructionHelpers;
|
||||||
use dom::servohtmlparser;
|
use dom::servohtmlparser;
|
||||||
use dom::servohtmlparser::{ServoHTMLParser, FragmentContext};
|
use dom::servohtmlparser::{ServoHTMLParser, FragmentContext};
|
||||||
use dom::text::Text;
|
use dom::text::Text;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue