aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/htmlserializer.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-02-06 13:46:58 -0500
committerbors-servo <release+servo@mozilla.com>2014-02-06 13:46:58 -0500
commit799e0ace786582f79b54d3652de5e84cd88bedbf (patch)
treecd10cb6d641e4b89151dce05a7b82733a63e15af /src/components/script/dom/htmlserializer.rs
parent5a7d22c43775264359b8ddea8f60d237f5715593 (diff)
parentaa4b5bb9482dbaaca9b76e7c9e54d5654ba22007 (diff)
downloadservo-799e0ace786582f79b54d3652de5e84cd88bedbf.tar.gz
servo-799e0ace786582f79b54d3652de5e84cd88bedbf.zip
auto merge of #1620 : brunoabinader/servo/dom-processinginstruction, r=Ms2ger
Spec: http://dom.spec.whatwg.org/#interface-processinginstruction Closes #1619.
Diffstat (limited to 'src/components/script/dom/htmlserializer.rs')
-rw-r--r--src/components/script/dom/htmlserializer.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/components/script/dom/htmlserializer.rs b/src/components/script/dom/htmlserializer.rs
index 8dbedcb2679..260fa437154 100644
--- a/src/components/script/dom/htmlserializer.rs
+++ b/src/components/script/dom/htmlserializer.rs
@@ -5,7 +5,9 @@
use servo_util::namespace;
use dom::attr::Attr;
use dom::node::NodeIterator;
-use dom::node::{DoctypeNodeTypeId, DocumentFragmentNodeTypeId, CommentNodeTypeId, DocumentNodeTypeId, ElementNodeTypeId, TextNodeTypeId, AbstractNode};
+use dom::node::{DoctypeNodeTypeId, DocumentFragmentNodeTypeId, CommentNodeTypeId};
+use dom::node::{DocumentNodeTypeId, ElementNodeTypeId, ProcessingInstructionNodeTypeId};
+use dom::node::{TextNodeTypeId, AbstractNode};
pub fn serialize(iterator: &mut NodeIterator) -> ~str {
let mut html = ~"";
@@ -29,6 +31,9 @@ pub fn serialize(iterator: &mut NodeIterator) -> ~str {
DoctypeNodeTypeId => {
serialize_doctype(node)
}
+ ProcessingInstructionNodeTypeId => {
+ serialize_processing_instruction(node)
+ }
DocumentFragmentNodeTypeId => {
~""
}
@@ -70,6 +75,12 @@ fn serialize_text(node: AbstractNode) -> ~str {
})
}
+fn serialize_processing_instruction(node: AbstractNode) -> ~str {
+ node.with_imm_processing_instruction(|processing_instruction| {
+ ~"<?" + processing_instruction.target + " " + processing_instruction.element.data + "?>"
+ })
+}
+
fn serialize_doctype(node: AbstractNode) -> ~str {
node.with_imm_doctype(|doctype| {
~"<!DOCTYPE" + doctype.name + ">"