[webkit-changes] cvs commit:
WebCore/layout-tests/dom/html/level2/html selfhtml.js
Vicki
vicki at opensource.apple.com
Wed Aug 10 18:01:52 PDT 2005
vicki 05/08/10 18:01:52
Modified: . ChangeLog
layout-tests/dom/html/level1/core
hc_attrappendchild5-expected.txt
hc_attrinsertbefore6-expected.txt
hc_elementwrongdocumenterr-expected.txt
hc_namednodemapwrongdocumenterr-expected.txt
hc_nodeappendchildnewchilddiffdocument-expected.txt
hc_nodeinsertbeforenewchilddiffdocument-expected.txt
hc_nodereplacechildnewchilddiffdocument-expected.txt
selfhtml.js
layout-tests/dom/html/level2/core selfhtml.js
layout-tests/dom/html/level2/events selfhtml.js
layout-tests/dom/html/level2/html selfhtml.js
Log:
Changes from Curt Arnold, reviewed by Vicki.
Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4174 (DOM layout tests involving two
documents fail due to test framework problem), and update expected results for tests
affected by this change.
* layout-tests/dom/html/level1/core/hc_attrappendchild5-expected.txt:
* layout-tests/dom/html/level1/core/hc_attrinsertbefore6-expected.txt:
* layout-tests/dom/html/level1/core/hc_elementwrongdocumenterr-expected.txt:
* layout-tests/dom/html/level1/core/hc_namednodemapwrongdocumenterr-expected.txt:
* layout-tests/dom/html/level1/core/hc_nodeappendchildnewchilddiffdocument-expected.txt:
* layout-tests/dom/html/level1/core/hc_nodeinsertbeforenewchilddiffdocument-expected.txt:
* layout-tests/dom/html/level1/core/hc_nodereplacechildnewchilddiffdocument-expected.txt:
* layout-tests/dom/html/level1/core/selfhtml.js:
* layout-tests/dom/html/level2/core/selfhtml.js:
* layout-tests/dom/html/level2/events/selfhtml.js:
* layout-tests/dom/html/level2/html/selfhtml.js:
Revision Changes Path
1.4556 +20 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4555
retrieving revision 1.4556
diff -u -r1.4555 -r1.4556
--- ChangeLog 11 Aug 2005 00:42:06 -0000 1.4555
+++ ChangeLog 11 Aug 2005 01:01:39 -0000 1.4556
@@ -1,3 +1,23 @@
+2005-08-10 Vicki Murley <vicki at apple.com>
+
+ Changes from Curt Arnold, reviewed by Vicki.
+
+ Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4174 (DOM layout tests involving two
+ documents fail due to test framework problem), and update expected results for tests
+ affected by this change.
+
+ * layout-tests/dom/html/level1/core/hc_attrappendchild5-expected.txt:
+ * layout-tests/dom/html/level1/core/hc_attrinsertbefore6-expected.txt:
+ * layout-tests/dom/html/level1/core/hc_elementwrongdocumenterr-expected.txt:
+ * layout-tests/dom/html/level1/core/hc_namednodemapwrongdocumenterr-expected.txt:
+ * layout-tests/dom/html/level1/core/hc_nodeappendchildnewchilddiffdocument-expected.txt:
+ * layout-tests/dom/html/level1/core/hc_nodeinsertbeforenewchilddiffdocument-expected.txt:
+ * layout-tests/dom/html/level1/core/hc_nodereplacechildnewchilddiffdocument-expected.txt:
+ * layout-tests/dom/html/level1/core/selfhtml.js:
+ * layout-tests/dom/html/level2/core/selfhtml.js:
+ * layout-tests/dom/html/level2/events/selfhtml.js:
+ * layout-tests/dom/html/level2/html/selfhtml.js:
+
2005-08-10 Eric Seidel <eseidel at apple.com>
Reviewed by darin.
1.2 +2 -2 WebCore/layout-tests/dom/html/level1/core/hc_attrappendchild5-expected.txt
Index: hc_attrappendchild5-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_attrappendchild5-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_attrappendchild5-expected.txt 26 Jul 2005 08:31:40 -0000 1.1
+++ hc_attrappendchild5-expected.txt 11 Aug 2005 01:01:49 -0000 1.2
@@ -1,3 +1,3 @@
Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild5
-Status: error
-Detail: TypeError: Null value
+Status: failure
+Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed
1.2 +2 -2 WebCore/layout-tests/dom/html/level1/core/hc_attrinsertbefore6-expected.txt
Index: hc_attrinsertbefore6-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_attrinsertbefore6-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_attrinsertbefore6-expected.txt 26 Jul 2005 08:31:41 -0000 1.1
+++ hc_attrinsertbefore6-expected.txt 11 Aug 2005 01:01:49 -0000 1.2
@@ -1,3 +1,3 @@
Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore6
-Status: error
-Detail: TypeError: Null value
+Status: failure
+Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed
1.2 +2 -3 WebCore/layout-tests/dom/html/level1/core/hc_elementwrongdocumenterr-expected.txt
Index: hc_elementwrongdocumenterr-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_elementwrongdocumenterr-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_elementwrongdocumenterr-expected.txt 26 Jul 2005 08:31:48 -0000 1.1
+++ hc_elementwrongdocumenterr-expected.txt 11 Aug 2005 01:01:49 -0000 1.2
@@ -1,3 +1,2 @@
-Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr
-Status: error
-Detail: TypeError: Null value
+Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr
+Status: Success
1.2 +2 -3 WebCore/layout-tests/dom/html/level1/core/hc_namednodemapwrongdocumenterr-expected.txt
Index: hc_namednodemapwrongdocumenterr-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_namednodemapwrongdocumenterr-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_namednodemapwrongdocumenterr-expected.txt 26 Jul 2005 08:31:49 -0000 1.1
+++ hc_namednodemapwrongdocumenterr-expected.txt 11 Aug 2005 01:01:49 -0000 1.2
@@ -1,3 +1,2 @@
-Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr
-Status: error
-Detail: TypeError: Null value
+Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr
+Status: Success
1.2 +2 -2 WebCore/layout-tests/dom/html/level1/core/hc_nodeappendchildnewchilddiffdocument-expected.txt
Index: hc_nodeappendchildnewchilddiffdocument-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_nodeappendchildnewchilddiffdocument-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_nodeappendchildnewchilddiffdocument-expected.txt 26 Jul 2005 08:31:50 -0000 1.1
+++ hc_nodeappendchildnewchilddiffdocument-expected.txt 11 Aug 2005 01:01:49 -0000 1.2
@@ -1,3 +1,3 @@
Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnewchilddiffdocument
-Status: error
-Detail: TypeError: Null value
+Status: failure
+Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed
1.2 +2 -2 WebCore/layout-tests/dom/html/level1/core/hc_nodeinsertbeforenewchilddiffdocument-expected.txt
Index: hc_nodeinsertbeforenewchilddiffdocument-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_nodeinsertbeforenewchilddiffdocument-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_nodeinsertbeforenewchilddiffdocument-expected.txt 26 Jul 2005 08:31:53 -0000 1.1
+++ hc_nodeinsertbeforenewchilddiffdocument-expected.txt 11 Aug 2005 01:01:49 -0000 1.2
@@ -1,3 +1,3 @@
Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchilddiffdocument
-Status: error
-Detail: TypeError: Null value
+Status: failure
+Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed
1.2 +2 -2 WebCore/layout-tests/dom/html/level1/core/hc_nodereplacechildnewchilddiffdocument-expected.txt
Index: hc_nodereplacechildnewchilddiffdocument-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/hc_nodereplacechildnewchilddiffdocument-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hc_nodereplacechildnewchilddiffdocument-expected.txt 26 Jul 2005 08:31:54 -0000 1.1
+++ hc_nodereplacechildnewchilddiffdocument-expected.txt 11 Aug 2005 01:01:50 -0000 1.2
@@ -1,3 +1,3 @@
Test: http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchilddiffdocument
-Status: error
-Detail: TypeError: Null value
+Status: failure
+Detail: throw_WRONG_DOCUMENT_ERR: assertTrue failed
1.2 +105 -1 WebCore/layout-tests/dom/html/level1/core/selfhtml.js
Index: selfhtml.js
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level1/core/selfhtml.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- selfhtml.js 26 Jul 2005 08:31:56 -0000 1.1
+++ selfhtml.js 11 Aug 2005 01:01:50 -0000 1.2
@@ -9,8 +9,16 @@
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
+
+//
+// Webkit modification: 28-July-2005
+//
if (window.layoutTestController)
layoutTestController.dumpAsText();
+//
+// End modification
+//
+
function assertSize(descr, expected, actual) {
var actualSize;
@@ -377,11 +385,107 @@
return 1;
}
+HTMLBuilder.prototype.cloneNode = function(srcNode, doc) {
+ var clone = null;
+ switch(srcNode.nodeType) {
+ //
+ // element
+ case 1:
+ clone = doc.createElement(srcNode.nodeName.toLowerCase());
+ var attrs = srcNode.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+ var srcChild = srcNode.firstChild;
+ while(srcChild != null) {
+ var cloneChild = this.cloneNode(srcChild, doc);
+ if (cloneChild != null) {
+ clone.appendChild(cloneChild);
+ }
+ srcChild = srcChild.nextSibling;
+ }
+ break;
+
+ case 3:
+ clone = doc.createTextNode(srcNode.nodeValue);
+ break;
+
+ case 4:
+ clone = doc.createCDATASection(srcNode.nodeValue);
+ break;
+
+ case 7:
+ clone = doc.createProcessingInstruction(srcNode.nodeValue);
+ break;
+
+ case 8:
+ clone = doc.createComment(srcNode.nodeValue);
+ break;
+ }
+ return clone;
+
+}
+
+
HTMLBuilder.prototype.load = function(frame, varname, url) {
if (this.documentVarnames[0] == varname) {
return document;
}
- return document.cloneNode(true);
+ //
+ //
+ // not a perfect way to do this
+ // Document.cloneNode is implementation dependent but exists in L1
+ // and implemented in IE. The alternative brute force copy
+ // only works in L2 or higher implementations and can't copy
+ // entity and notation definitions, etc.
+ var clone = null;
+ try {
+ clone = document.cloneNode(true);
+ } catch(ex) {
+ }
+ if (clone == null) {
+ clone = document.implementation.createDocument(
+ document.documentElement.namespaceURI,
+ document.documentElement.nodeName,
+ null);
+ //
+ // Work-around since
+ // Safari does not create document element
+ // create document.
+ if (clone.documentElement == null) {
+ clone.appendChild(clone.createElement(document.documentElement.nodeName));
+ }
+ var attrs = document.documentElement.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.documentElement.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+
+ var srcNode = document.firstChild;
+ while(srcNode != null && srcNode.nodeType != 1) {
+ if (srcNode.nodeType != 10) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.insertBefore(cloneNode, clone.documentElement);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.nextSibling;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.appendChild(cloneNode);
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.firstChild;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ if (cloneNode != null) {
+ clone.documentElement.appendChild(cloneNode);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ }
+ return clone;
}
HTMLBuilder.prototype.getImplementationAttribute = function(attr) {
1.2 +105 -1 WebCore/layout-tests/dom/html/level2/core/selfhtml.js
Index: selfhtml.js
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level2/core/selfhtml.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- selfhtml.js 26 Jul 2005 08:35:08 -0000 1.1
+++ selfhtml.js 11 Aug 2005 01:01:51 -0000 1.2
@@ -9,8 +9,16 @@
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
+
+//
+// Webkit modification: 28-July-2005
+//
if (window.layoutTestController)
layoutTestController.dumpAsText();
+//
+// End modification
+//
+
function assertSize(descr, expected, actual) {
var actualSize;
@@ -377,11 +385,107 @@
return 1;
}
+HTMLBuilder.prototype.cloneNode = function(srcNode, doc) {
+ var clone = null;
+ switch(srcNode.nodeType) {
+ //
+ // element
+ case 1:
+ clone = doc.createElement(srcNode.nodeName.toLowerCase());
+ var attrs = srcNode.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+ var srcChild = srcNode.firstChild;
+ while(srcChild != null) {
+ var cloneChild = this.cloneNode(srcChild, doc);
+ if (cloneChild != null) {
+ clone.appendChild(cloneChild);
+ }
+ srcChild = srcChild.nextSibling;
+ }
+ break;
+
+ case 3:
+ clone = doc.createTextNode(srcNode.nodeValue);
+ break;
+
+ case 4:
+ clone = doc.createCDATASection(srcNode.nodeValue);
+ break;
+
+ case 7:
+ clone = doc.createProcessingInstruction(srcNode.nodeValue);
+ break;
+
+ case 8:
+ clone = doc.createComment(srcNode.nodeValue);
+ break;
+ }
+ return clone;
+
+}
+
+
HTMLBuilder.prototype.load = function(frame, varname, url) {
if (this.documentVarnames[0] == varname) {
return document;
}
- return document.cloneNode(true);
+ //
+ //
+ // not a perfect way to do this
+ // Document.cloneNode is implementation dependent but exists in L1
+ // and implemented in IE. The alternative brute force copy
+ // only works in L2 or higher implementations and can't copy
+ // entity and notation definitions, etc.
+ var clone = null;
+ try {
+ clone = document.cloneNode(true);
+ } catch(ex) {
+ }
+ if (clone == null) {
+ clone = document.implementation.createDocument(
+ document.documentElement.namespaceURI,
+ document.documentElement.nodeName,
+ null);
+ //
+ // Work-around since
+ // Safari does not create document element
+ // create document.
+ if (clone.documentElement == null) {
+ clone.appendChild(clone.createElement(document.documentElement.nodeName));
+ }
+ var attrs = document.documentElement.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.documentElement.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+
+ var srcNode = document.firstChild;
+ while(srcNode != null && srcNode.nodeType != 1) {
+ if (srcNode.nodeType != 10) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.insertBefore(cloneNode, clone.documentElement);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.nextSibling;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.appendChild(cloneNode);
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.firstChild;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ if (cloneNode != null) {
+ clone.documentElement.appendChild(cloneNode);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ }
+ return clone;
}
HTMLBuilder.prototype.getImplementationAttribute = function(attr) {
1.2 +137 -6 WebCore/layout-tests/dom/html/level2/events/selfhtml.js
Index: selfhtml.js
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level2/events/selfhtml.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- selfhtml.js 26 Jul 2005 08:35:13 -0000 1.1
+++ selfhtml.js 11 Aug 2005 01:01:51 -0000 1.2
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2001-2004 World Wide Web Consortium,
+Copyright (c) 2001-2005 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the W3C(r) Software License [1] in the
@@ -9,8 +9,16 @@
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
+
+//
+// Webkit modification: 28-July-2005
+//
if (window.layoutTestController)
layoutTestController.dumpAsText();
+//
+// End modification
+//
+
function assertSize(descr, expected, actual) {
var actualSize;
@@ -242,10 +250,6 @@
return expected === actual;
}
-function getSuffix(contentType) {
- return ".html";
-}
-
function equalsAutoCase(context, expected, actual) {
if (builder.contentType == "text/html") {
if (context == "attribute") {
@@ -381,11 +385,107 @@
return 1;
}
+HTMLBuilder.prototype.cloneNode = function(srcNode, doc) {
+ var clone = null;
+ switch(srcNode.nodeType) {
+ //
+ // element
+ case 1:
+ clone = doc.createElement(srcNode.nodeName.toLowerCase());
+ var attrs = srcNode.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+ var srcChild = srcNode.firstChild;
+ while(srcChild != null) {
+ var cloneChild = this.cloneNode(srcChild, doc);
+ if (cloneChild != null) {
+ clone.appendChild(cloneChild);
+ }
+ srcChild = srcChild.nextSibling;
+ }
+ break;
+
+ case 3:
+ clone = doc.createTextNode(srcNode.nodeValue);
+ break;
+
+ case 4:
+ clone = doc.createCDATASection(srcNode.nodeValue);
+ break;
+
+ case 7:
+ clone = doc.createProcessingInstruction(srcNode.nodeValue);
+ break;
+
+ case 8:
+ clone = doc.createComment(srcNode.nodeValue);
+ break;
+ }
+ return clone;
+
+}
+
+
HTMLBuilder.prototype.load = function(frame, varname, url) {
if (this.documentVarnames[0] == varname) {
return document;
}
- return document.cloneNode(true);
+ //
+ //
+ // not a perfect way to do this
+ // Document.cloneNode is implementation dependent but exists in L1
+ // and implemented in IE. The alternative brute force copy
+ // only works in L2 or higher implementations and can't copy
+ // entity and notation definitions, etc.
+ var clone = null;
+ try {
+ clone = document.cloneNode(true);
+ } catch(ex) {
+ }
+ if (clone == null) {
+ clone = document.implementation.createDocument(
+ document.documentElement.namespaceURI,
+ document.documentElement.nodeName,
+ null);
+ //
+ // Work-around since
+ // Safari does not create document element
+ // create document.
+ if (clone.documentElement == null) {
+ clone.appendChild(clone.createElement(document.documentElement.nodeName));
+ }
+ var attrs = document.documentElement.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.documentElement.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+
+ var srcNode = document.firstChild;
+ while(srcNode != null && srcNode.nodeType != 1) {
+ if (srcNode.nodeType != 10) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.insertBefore(cloneNode, clone.documentElement);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.nextSibling;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.appendChild(cloneNode);
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.firstChild;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ if (cloneNode != null) {
+ clone.documentElement.appendChild(cloneNode);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ }
+ return clone;
}
HTMLBuilder.prototype.getImplementationAttribute = function(attr) {
@@ -549,6 +649,37 @@
}
+
+function getSuffix(contentType) {
+ switch(contentType) {
+ case "text/xml":
+ return ".xml";
+
+ case "application/xhtml+xml":
+ return ".xhtml";
+
+ case "image/svg+xml":
+ return ".svg";
+
+ case "text/mathml":
+ return ".mml";
+ }
+ return ".html";
+}
+
+
+function getResourceURI(name, scheme, contentType) {
+ var base = document.documentURI;
+ if (base == null) {
+ base = "";
+ } else {
+ base = base.substring(0, base.lastIndexOf('/') + 1) + "files/";
+ }
+ return base + name + getSuffix(contentType);
+}
+
+
+
function startTest() {
//
// invoke test setup
1.2 +105 -1 WebCore/layout-tests/dom/html/level2/html/selfhtml.js
Index: selfhtml.js
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/dom/html/level2/html/selfhtml.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- selfhtml.js 26 Jul 2005 08:36:03 -0000 1.1
+++ selfhtml.js 11 Aug 2005 01:01:51 -0000 1.2
@@ -9,8 +9,16 @@
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
+
+//
+// Webkit modification: 28-July-2005
+//
if (window.layoutTestController)
layoutTestController.dumpAsText();
+//
+// End modification
+//
+
function assertSize(descr, expected, actual) {
var actualSize;
@@ -377,11 +385,107 @@
return 1;
}
+HTMLBuilder.prototype.cloneNode = function(srcNode, doc) {
+ var clone = null;
+ switch(srcNode.nodeType) {
+ //
+ // element
+ case 1:
+ clone = doc.createElement(srcNode.nodeName.toLowerCase());
+ var attrs = srcNode.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+ var srcChild = srcNode.firstChild;
+ while(srcChild != null) {
+ var cloneChild = this.cloneNode(srcChild, doc);
+ if (cloneChild != null) {
+ clone.appendChild(cloneChild);
+ }
+ srcChild = srcChild.nextSibling;
+ }
+ break;
+
+ case 3:
+ clone = doc.createTextNode(srcNode.nodeValue);
+ break;
+
+ case 4:
+ clone = doc.createCDATASection(srcNode.nodeValue);
+ break;
+
+ case 7:
+ clone = doc.createProcessingInstruction(srcNode.nodeValue);
+ break;
+
+ case 8:
+ clone = doc.createComment(srcNode.nodeValue);
+ break;
+ }
+ return clone;
+
+}
+
+
HTMLBuilder.prototype.load = function(frame, varname, url) {
if (this.documentVarnames[0] == varname) {
return document;
}
- return document.cloneNode(true);
+ //
+ //
+ // not a perfect way to do this
+ // Document.cloneNode is implementation dependent but exists in L1
+ // and implemented in IE. The alternative brute force copy
+ // only works in L2 or higher implementations and can't copy
+ // entity and notation definitions, etc.
+ var clone = null;
+ try {
+ clone = document.cloneNode(true);
+ } catch(ex) {
+ }
+ if (clone == null) {
+ clone = document.implementation.createDocument(
+ document.documentElement.namespaceURI,
+ document.documentElement.nodeName,
+ null);
+ //
+ // Work-around since
+ // Safari does not create document element
+ // create document.
+ if (clone.documentElement == null) {
+ clone.appendChild(clone.createElement(document.documentElement.nodeName));
+ }
+ var attrs = document.documentElement.attributes;
+ for(var i = 0; i < attrs.length; i++) {
+ var srcAttr = attrs.item(i);
+ clone.documentElement.setAttribute(srcAttr.nodeName, srcAttr.nodeValue);
+ }
+
+ var srcNode = document.firstChild;
+ while(srcNode != null && srcNode.nodeType != 1) {
+ if (srcNode.nodeType != 10) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.insertBefore(cloneNode, clone.documentElement);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.nextSibling;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ clone.appendChild(cloneNode);
+ srcNode = srcNode.nextSibling;
+ }
+ srcNode = document.documentElement.firstChild;
+ while(srcNode != null) {
+ var cloneNode = this.cloneNode(srcNode, clone);
+ if (cloneNode != null) {
+ clone.documentElement.appendChild(cloneNode);
+ }
+ srcNode = srcNode.nextSibling;
+ }
+ }
+ return clone;
}
HTMLBuilder.prototype.getImplementationAttribute = function(attr) {
More information about the webkit-changes
mailing list