[webkit-changes] cvs commit: WebCore/layout-tests/fast/dom
XMLSerializer-expected.txt XMLSerializer.html
Vicki
vicki at opensource.apple.com
Tue Aug 9 12:15:57 PDT 2005
vicki 05/08/09 12:15:57
Modified: . ChangeLog
khtml/ecma xmlserializer.cpp
Added: layout-tests/fast/dom XMLSerializer-expected.txt
XMLSerializer.html
Log:
Fixed by Anders Carlsson, Reviewed by Maciej.
- fixed <rdar://problem/4071417> add XMLSerializer object to WebCore's JavaScript support (4046)
Test cases added:
* layout-tests/fast/dom/XMLSerializer-expected.txt: Added.
* layout-tests/fast/dom/XMLSerializer.html: Added.
* khtml/ecma/xmlserializer.cpp:
(KJS::XMLSerializerProtoFunc::callAsFunction): allow any node to be serialized, not just documents
Revision Changes Path
1.4546 +13 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4545
retrieving revision 1.4546
diff -u -r1.4545 -r1.4546
--- ChangeLog 9 Aug 2005 17:33:34 -0000 1.4545
+++ ChangeLog 9 Aug 2005 19:15:46 -0000 1.4546
@@ -1,3 +1,16 @@
+2005-08-09 Vicki Murley <vicki at apple.com>
+
+ Fixed by Anders Carlsson, Reviewed by Maciej.
+
+ - fixed <rdar://problem/4071417> add XMLSerializer object to WebCore's JavaScript support (4046)
+
+ Test cases added:
+ * layout-tests/fast/dom/XMLSerializer-expected.txt: Added.
+ * layout-tests/fast/dom/XMLSerializer.html: Added.
+
+ * khtml/ecma/xmlserializer.cpp:
+ (KJS::XMLSerializerProtoFunc::callAsFunction): allow any node to be serialized, not just documents
+
2005-08-09 Adele Peterson <adele at apple.com>
Reviewed by Darin.
1.6 +4 -4 WebCore/khtml/ecma/xmlserializer.cpp
Index: xmlserializer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/xmlserializer.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xmlserializer.cpp 8 Aug 2005 04:07:42 -0000 1.5
+++ xmlserializer.cpp 9 Aug 2005 19:15:56 -0000 1.6
@@ -28,7 +28,7 @@
#include <kdebug.h>
-using DOM::DocumentImpl;
+using DOM::NodeImpl;
namespace KJS {
@@ -85,12 +85,12 @@
return Undefined();
}
- if (!args[0]->toObject(exec)->inherits(&DOMDocument::info)) {
+ if (!args[0]->toObject(exec)->inherits(&DOMNode::info)) {
return Undefined();
}
- DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0]->toObject(exec))->impl());
- return getStringOrNull(doc->toString().string());
+ NodeImpl *node = static_cast<NodeImpl *>(static_cast<DOMNode *>(args[0]->toObject(exec))->impl());
+ return getStringOrNull(node->toString().string());
}
}
1.1 WebCore/layout-tests/fast/dom/XMLSerializer-expected.txt
Index: XMLSerializer-expected.txt
===================================================================
This tests XMLSerializer on different node types. If the test is successful, there should be four lines of output. The first line should be the child1 tag. The second should be the child2 tag. The third one should be a comment and the fourth one should be the complete document.
<child1>First child</child1>
<child2 attr="an attribute">Second child</child2>
<!-- A comment -->
<test><child1>First child</child1><child2 attr="an attribute">Second child</child2><!-- A comment --></test>
1.1 WebCore/layout-tests/fast/dom/XMLSerializer.html
Index: XMLSerializer.html
===================================================================
<html>
<head>
<script>
function debug(str) {
li = document.createElement('li');
li.appendChild(document.createTextNode(str));
document.getElementById('console').appendChild(li);
}
function parseDocument() {
str = '<test><child1>First child</child1>';
str += '<child2 attr="an attribute">Second child</child2>';
str += '<!-- A comment --></test>';
parser = new DOMParser();
doc = parser.parseFromString(str, 'text/xml');
return doc;
}
function runTests() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
}
doc = parseDocument();
child1 = doc.documentElement.firstChild;
child2 = child1.nextSibling
comment = child2.nextSibling;
serializer = new XMLSerializer();
debug(serializer.serializeToString(child1));
debug(serializer.serializeToString(child2));
debug(serializer.serializeToString(comment));
debug(serializer.serializeToString(doc));
}
</script>
</head>
<body onload="runTests()">
This tests XMLSerializer on different node types. If the test is successful, there should be four lines of output. The first line should be the child1 tag. The second should be the child2 tag. The third one should be a comment and the fourth one should be the complete document.
<ul id="console">
</ul>
</body>
</html>
More information about the webkit-changes
mailing list