diff options
author | Sankha Narayan Guria <sankha93@gmail.com> | 2014-02-27 03:31:05 +0530 |
---|---|---|
committer | Sankha Narayan Guria <sankha93@gmail.com> | 2014-02-27 03:31:05 +0530 |
commit | 1e9fec9172364346937f375e315e1ce745662611 (patch) | |
tree | a55173568e6dd6a8b4cb4dfcc42ed81204d49874 /src/components/script/dom/processinginstruction.rs | |
parent | 47e6e6ec8f2dfbd56e50f9f2ec2762b85087d948 (diff) | |
parent | da16e54243e256dee927f720ce6b9903b62ec14e (diff) | |
download | servo-1e9fec9172364346937f375e315e1ce745662611.tar.gz servo-1e9fec9172364346937f375e315e1ce745662611.zip |
Merge master into this branch
Diffstat (limited to 'src/components/script/dom/processinginstruction.rs')
-rw-r--r-- | src/components/script/dom/processinginstruction.rs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/components/script/dom/processinginstruction.rs b/src/components/script/dom/processinginstruction.rs index 0fd830be452..85d247fe94a 100644 --- a/src/components/script/dom/processinginstruction.rs +++ b/src/components/script/dom/processinginstruction.rs @@ -3,28 +3,41 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::ProcessingInstructionBinding; +use dom::bindings::codegen::InheritTypes::ProcessingInstructionDerived; +use dom::bindings::js::JS; use dom::characterdata::CharacterData; -use dom::document::AbstractDocument; -use dom::node::{AbstractNode, Node, ProcessingInstructionNodeTypeId}; +use dom::document::Document; +use dom::eventtarget::{EventTarget, NodeTargetTypeId}; +use dom::node::{Node, ProcessingInstructionNodeTypeId}; use servo_util::str::DOMString; /// An HTML processing instruction node. +#[deriving(Encodable)] pub struct ProcessingInstruction { characterdata: CharacterData, target: DOMString, } +impl ProcessingInstructionDerived for EventTarget { + fn is_processinginstruction(&self) -> bool { + match self.type_id { + NodeTargetTypeId(ProcessingInstructionNodeTypeId) => true, + _ => false + } + } +} + impl ProcessingInstruction { - pub fn new_inherited(target: DOMString, data: DOMString, document: AbstractDocument) -> ProcessingInstruction { + pub fn new_inherited(target: DOMString, data: DOMString, document: JS<Document>) -> ProcessingInstruction { ProcessingInstruction { characterdata: CharacterData::new_inherited(ProcessingInstructionNodeTypeId, data, document), target: target } } - pub fn new(target: DOMString, data: DOMString, document: AbstractDocument) -> AbstractNode { - let node = ProcessingInstruction::new_inherited(target, data, document); - Node::reflect_node(@mut node, document, ProcessingInstructionBinding::Wrap) + pub fn new(target: DOMString, data: DOMString, document: &JS<Document>) -> JS<ProcessingInstruction> { + let node = ProcessingInstruction::new_inherited(target, data, document.clone()); + Node::reflect_node(~node, document, ProcessingInstructionBinding::Wrap) } } |