mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Privatize ProcessingInstruction
This commit is contained in:
parent
ad6649d102
commit
d0addd36bb
3 changed files with 17 additions and 8 deletions
|
@ -93,9 +93,9 @@ fn serialize_text(text: JSRef<Text>, html: &mut String) {
|
|||
fn serialize_processing_instruction(processing_instruction: JSRef<ProcessingInstruction>,
|
||||
html: &mut String) {
|
||||
html.push_str("<?");
|
||||
html.push_str(processing_instruction.target.as_slice());
|
||||
html.push_str(processing_instruction.target().as_slice());
|
||||
html.push_char(' ');
|
||||
html.push_str(processing_instruction.characterdata.data().as_slice());
|
||||
html.push_str(processing_instruction.characterdata().data().as_slice());
|
||||
html.push_str("?>");
|
||||
}
|
||||
|
||||
|
|
|
@ -1496,8 +1496,8 @@ impl Node {
|
|||
},
|
||||
ProcessingInstructionNodeTypeId => {
|
||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||
let pi = ProcessingInstruction::new(pi.target.clone(),
|
||||
pi.characterdata.data().clone(), *document);
|
||||
let pi = ProcessingInstruction::new(pi.target().clone(),
|
||||
pi.characterdata().data().clone(), *document);
|
||||
NodeCast::from_temporary(pi)
|
||||
},
|
||||
}.root();
|
||||
|
@ -1974,8 +1974,8 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
fn is_equal_processinginstruction(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||
let other_pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(other).unwrap();
|
||||
(pi.target == other_pi.target) &&
|
||||
(*pi.characterdata.data() == *other_pi.characterdata.data())
|
||||
(*pi.target() == *other_pi.target()) &&
|
||||
(*pi.characterdata().data() == *other_pi.characterdata().data())
|
||||
}
|
||||
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
|
||||
|
|
|
@ -16,9 +16,10 @@ use servo_util::str::DOMString;
|
|||
/// An HTML processing instruction node.
|
||||
#[jstraceable]
|
||||
#[must_root]
|
||||
#[privatize]
|
||||
pub struct ProcessingInstruction {
|
||||
pub characterdata: CharacterData,
|
||||
pub target: DOMString,
|
||||
characterdata: CharacterData,
|
||||
target: DOMString,
|
||||
}
|
||||
|
||||
impl ProcessingInstructionDerived for EventTarget {
|
||||
|
@ -39,6 +40,14 @@ impl ProcessingInstruction {
|
|||
Node::reflect_node(box ProcessingInstruction::new_inherited(target, data, document),
|
||||
document, ProcessingInstructionBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
|
||||
&self.characterdata
|
||||
}
|
||||
|
||||
pub fn target<'a>(&'a self) -> &'a DOMString {
|
||||
&self.target
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ProcessingInstructionMethods for JSRef<'a, ProcessingInstruction> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue