mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Add new XMLSerializer().serializeToString functionality
This commit is contained in:
parent
9832feddf3
commit
1ffe8f059a
4 changed files with 10 additions and 2 deletions
|
@ -167,7 +167,7 @@ fn rev_children_iter(n: &Node) -> impl Iterator<Item = DomRoot<Node>> {
|
|||
impl SerializationIterator {
|
||||
fn new(node: &Node, skip_first: bool) -> SerializationIterator {
|
||||
let mut ret = SerializationIterator { stack: vec![] };
|
||||
if skip_first || node.is::<DocumentFragment>() {
|
||||
if skip_first || node.is::<DocumentFragment>() || node.is::<Document>() {
|
||||
for c in rev_children_iter(node) {
|
||||
ret.push_node(&*c);
|
||||
}
|
||||
|
|
|
@ -642622,7 +642622,7 @@
|
|||
"support"
|
||||
],
|
||||
"domparsing/XMLSerializer-serializeToString.html": [
|
||||
"23b9ce841f5046f180ce78d92d7ac1132712f999",
|
||||
"1ee9b8014c5d0983a02722a0db8caa83df958439",
|
||||
"testharness"
|
||||
],
|
||||
"domparsing/createContextualFragment.html": [
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
[XMLSerializer-serializeToString.html]
|
||||
type: testharness
|
||||
[check XMLSerializer.serializeToString method could parsing document to string]
|
||||
expected: FAIL
|
||||
|
||||
[Check if the default namespace is correctly reset.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ test(function() {
|
|||
assert_equals(serialize(root), '<root><child1>value1</child1></root>');
|
||||
}, 'check XMLSerializer.serializeToString method could parsing xmldoc to string');
|
||||
|
||||
test(function() {
|
||||
var root = parse('<html><head></head><body><div></div><span></span></body></html>');
|
||||
assert_equals(serialize(root.ownerDocument), '<html><head/><body><div/><span/></body></html>');
|
||||
}, 'check XMLSerializer.serializeToString method could parsing document to string');
|
||||
|
||||
test(function() {
|
||||
var root = createXmlDoc().documentElement;
|
||||
var element = root.ownerDocument.createElementNS('urn:foo', 'another');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue