Index: LayoutTests/dom/xhtml/level2/events/selfxhtml.js |
diff --git a/LayoutTests/dom/xhtml/level2/events/selfxhtml.js b/LayoutTests/dom/xhtml/level2/events/selfxhtml.js |
index e1f2205d242dad7131ac56e9e4b772c6533351cc..a68a77ff11f1131dfda2c439f15ad3763c50e4cd 100644 |
--- a/LayoutTests/dom/xhtml/level2/events/selfxhtml.js |
+++ b/LayoutTests/dom/xhtml/level2/events/selfxhtml.js |
@@ -1,10 +1,10 @@ |
/* |
-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 |
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+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 |
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 |
*/ |
@@ -17,23 +17,22 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
} |
function assertEqualsAutoCase(context, descr, expected, actual) { |
- if (builder.contentType == "text/html") { |
- if(context == "attribute") { |
- assertEquals(descr, expected.toLowerCase(), actual.toLowerCase()); |
- } else { |
- assertEquals(descr, expected.toUpperCase(), actual); |
- } |
- } else { |
- assertEquals(descr, expected, actual); |
- } |
+ if (builder.contentType == "text/html") { |
+ if(context == "attribute") { |
+ assertEquals(descr, expected.toLowerCase(), actual.toLowerCase()); |
+ } else { |
+ assertEquals(descr, expected.toUpperCase(), actual); |
+ } |
+ } else { |
+ assertEquals(descr, expected, actual); |
+ } |
} |
- |
function assertEqualsCollectionAutoCase(context, descr, expected, actual) { |
// |
// if they aren't the same size, they aren't equal |
assertEquals(descr, expected.length, actual.length); |
- |
+ |
// |
// if there length is the same, then every entry in the expected list |
// must appear once and only once in the actual list |
@@ -47,19 +46,19 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
matches = 0; |
expectedValue = expected[i]; |
for(j = 0; j < actualLen; j++) { |
- if (builder.contentType == "text/html") { |
- if (context == "attribute") { |
- if (expectedValue.toLowerCase() == actual[j].toLowerCase()) { |
- matches++; |
- } |
- } else { |
- if (expectedValue.toUpperCase() == actual[j]) { |
- matches++; |
- } |
- } |
- } else { |
- if(expectedValue == actual[j]) { |
- matches++; |
+ if (builder.contentType == "text/html") { |
+ if (context == "attribute") { |
+ if (expectedValue.toLowerCase() == actual[j].toLowerCase()) { |
+ matches++; |
+ } |
+ } else { |
+ if (expectedValue.toUpperCase() == actual[j]) { |
+ matches++; |
+ } |
+ } |
+ } else { |
+ if(expectedValue == actual[j]) { |
+ matches++; |
} |
} |
} |
@@ -102,31 +101,29 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
} |
} |
- |
function assertEqualsListAutoCase(context, descr, expected, actual) { |
- var minLength = expected.length; |
- if (actual.length < minLength) { |
- minLength = actual.length; |
- } |
+ var minLength = expected.length; |
+ if (actual.length < minLength) { |
+ minLength = actual.length; |
+ } |
// |
for(var i = 0; i < minLength; i++) { |
- assertEqualsAutoCase(context, descr, expected[i], actual[i]); |
+ assertEqualsAutoCase(context, descr, expected[i], actual[i]); |
} |
// |
// if they aren't the same size, they aren't equal |
assertEquals(descr, expected.length, actual.length); |
} |
- |
function assertEqualsList(descr, expected, actual) { |
- var minLength = expected.length; |
- if (actual.length < minLength) { |
- minLength = actual.length; |
- } |
+ var minLength = expected.length; |
+ if (actual.length < minLength) { |
+ minLength = actual.length; |
+ } |
// |
for(var i = 0; i < minLength; i++) { |
if(expected[i] != actual[i]) { |
- assertEquals(descr, expected[i], actual[i]); |
+ assertEquals(descr, expected[i], actual[i]); |
} |
} |
// |
@@ -227,7 +224,6 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
} |
} |
- |
// size() used by assertSize element |
function size(collection) |
{ |
@@ -240,13 +236,13 @@ function same(expected, actual) |
} |
function equalsAutoCase(context, expected, actual) { |
- if (builder.contentType == "text/html") { |
- if (context == "attribute") { |
- return expected.toLowerCase() == actual; |
- } |
- return expected.toUpperCase() == actual; |
- } |
- return expected == actual; |
+ if (builder.contentType == "text/html") { |
+ if (context == "attribute") { |
+ return expected.toLowerCase() == actual; |
+ } |
+ return expected.toUpperCase() == actual; |
+ } |
+ return expected == actual; |
} |
function toLowerArray(src) { |
@@ -260,13 +256,11 @@ function toLowerArray(src) { |
function createTempURI(scheme) { |
if (scheme == "http") { |
- return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml"; |
+ return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml"; |
} |
return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml"; |
} |
- |
- |
function EventMonitor() { |
this.atEvents = new Array(); |
this.bubbledEvents = new Array(); |
@@ -279,7 +273,7 @@ EventMonitor.prototype.handleEvent = function(evt) { |
case 1: |
monitor.capturedEvents[monitor.capturedEvents.length] = evt; |
break; |
- |
+ |
case 2: |
monitor.atEvents[monitor.atEvents.length] = evt; |
break; |
@@ -300,8 +294,6 @@ function DOMErrorImpl(err) { |
this.location = err.location; |
} |
- |
- |
function DOMErrorMonitor() { |
this.allErrors = new Array(); |
} |
@@ -328,7 +320,7 @@ function UserDataNotification(operation, key, data, src, dst) { |
} |
function UserDataMonitor() { |
- this.allNotifications = new Array(); |
+ this.allNotifications = new Array(); |
} |
UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) { |
@@ -336,8 +328,6 @@ UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) { |
new UserDataNotification(operation, key, data, src, dst); |
} |
- |
- |
function HTMLBuilder() { |
this.contentType = "application/xhtml+xml"; |
this.supportedContentTypes = [ "application/xhtml+xml" ]; |
@@ -345,7 +335,7 @@ function HTMLBuilder() { |
this.supportsAsyncChange = false; |
this.async = false; |
this.fixedAttributeNames = [ |
- "validating", "expandEntityReferences", "coalescing", |
+ "validating", "expandEntityReferences", "coalescing", |
"signed", "hasNullString", "ignoringElementContentWhitespace", "namespaceAware", "ignoringComments", "schemaValidating"]; |
this.fixedAttributeValues = [false, true, false, true, true , false, true, false, false ]; |
@@ -404,35 +394,34 @@ HTMLBuilder.prototype.cloneNode = function(srcNode, doc) { |
srcChild = srcChild.nextSibling; |
} |
break; |
- |
+ |
case 3: |
clone = doc.createTextNode(srcNode.nodeValue); |
break; |
- |
+ |
case 4: |
clone = doc.createCDATASection(srcNode.nodeValue); |
break; |
- |
+ |
case 5: |
clone = doc.createEntityReference(srcNode.nodeName); |
break; |
- |
+ |
case 7: |
clone = doc.createProcessingInstruction(srcNode.target, srcNode.data); |
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; |
} |
// |
// |
@@ -453,11 +442,11 @@ HTMLBuilder.prototype.load = function(frame, varname, url) { |
null); |
// |
// Work-around since |
- // Safari does not create document element |
- // create document. |
+ // Safari does not create document element |
+ // create document. |
if (clone.documentElement == null) { |
clone.appendChild(clone.createElementNS( |
- document.documentElement.namespaceURI, |
+ document.documentElement.namespaceURI, |
document.documentElement.nodeName)); |
} |
var attrs = document.documentElement.attributes; |
@@ -470,10 +459,10 @@ HTMLBuilder.prototype.load = function(frame, varname, url) { |
var srcNode = document.firstChild; |
while(srcNode != null && srcNode.nodeType != 1) { |
if (srcNode.nodeType != 10) { |
- var cloneNode = this.cloneNode(srcNode, clone); |
+ var cloneNode = this.cloneNode(srcNode, clone); |
clone.insertBefore(cloneNode, clone.documentElement); |
} |
- srcNode = srcNode.nextSibling; |
+ srcNode = srcNode.nextSibling; |
} |
srcNode = document.documentElement.nextSibling; |
while(srcNode != null) { |
@@ -502,7 +491,6 @@ HTMLBuilder.prototype.getImplementationAttribute = function(attr) { |
throw "Unrecognized implementation attribute: " + attr; |
} |
- |
HTMLBuilder.prototype.setImplementationAttribute = function(attribute, value) { |
var supported = this.getImplementationAttribute(attribute); |
if (supported != value) { |
@@ -515,9 +503,6 @@ HTMLBuilder.prototype.canSetImplementationAttribute = function(attribute, value) |
return (supported == value); |
} |
- |
- |
- |
function createConfiguredBuilder() { |
return new HTMLBuilder(); |
} |
@@ -527,7 +512,6 @@ function catchInitializationError(buildr, ex) { |
buildr.initializationFatalError = ex; |
} |
- |
function checkFeature(feature, version) |
{ |
if (!builder.hasFeature(feature, version)) |
@@ -542,7 +526,7 @@ function checkFeature(feature, version) |
function setResult(resultType, message) { |
var testName = getTargetURI(); |
document.title = testName + ":" + resultType; |
- var xhtmlNS = "http://www.w3.org/1999/xhtml"; |
+ var xhtmlNS = "http://www.w3.org/1999/xhtml"; |
var newBody = document.createElementNS(xhtmlNS, "body"); |
var newTable = document.createElementNS(xhtmlNS, "table"); |
newTable.width = "100%"; |
@@ -559,19 +543,19 @@ function setResult(resultType, message) { |
var statusDiv2 = statusRow.insertCell(-1); |
var style = "color:green"; |
if (resultType == null) { |
- statusDiv2.appendChild(document.createTextNode("Success")); |
+ statusDiv2.appendChild(document.createTextNode("Success")); |
} else { |
- statusDiv2.appendChild(document.createTextNode(resultType)); |
- if (resultType == "skip") { |
- style = "color:blue"; |
- } else { |
- style = "color:red"; |
- } |
+ statusDiv2.appendChild(document.createTextNode(resultType)); |
+ if (resultType == "skip") { |
+ style = "color:blue"; |
+ } else { |
+ style = "color:red"; |
+ } |
} |
newTable.setAttributeNS(null, "style", style); |
if (message != null) { |
var messageRow = newTable.insertRow(-1); |
- var messageDiv1 = messageRow.insertCell(-1); |
+ var messageDiv1 = messageRow.insertCell(-1); |
messageDiv1.appendChild(document.createTextNode("Message")); |
var messageDiv2 = messageRow.insertCell(-1); |
messageDiv2.appendChild(document.createTextNode(message)); |
@@ -591,17 +575,14 @@ function preload(docRef, varname, href) { |
return builder.preload(docRef, varname, href); |
} |
- |
function load(docRef, varname, href) { |
return builder.load(docRef, varname, href); |
} |
- |
function getImplementationAttribute(attr) { |
return builder.getImplementationAttribute(attr); |
} |
- |
function setImplementationAttribute(attribute, value) { |
builder.setImplementationAttribute(attribute, value); |
} |
@@ -615,7 +596,6 @@ function createXPathEvaluator(doc) { |
return doc; |
} |
- |
function getImplementation() { |
return builder.getImplementation(); |
} |
@@ -627,7 +607,7 @@ function assertEquals(id, expected, actual) { |
if (actual == null) { |
myActual = "null"; |
} |
- throw "failure:" + id + ": assertEquals failed, actual " + myActual + ", expected " + expected + "."; |
+ throw "failure:" + id + ": assertEquals failed, actual " + myActual + ", expected " + expected + "."; |
} |
} |
@@ -637,14 +617,12 @@ function assertNull(id, actual) { |
} |
} |
- |
function assertTrue(id, actual) { |
if (!actual) { |
throw "failure:" + id + ": assertTrue failed"; |
} |
} |
- |
function assertFalse(id, actual) { |
if (actual) { |
throw "failure:" + id + ": assertTrue failed"; |
@@ -661,8 +639,6 @@ function fail(id) { |
throw "failure:" + id + ": fail"; |
} |
- |
- |
function getSuffix(contentType) { |
switch(contentType) { |
case "text/html": |
@@ -680,19 +656,16 @@ function getSuffix(contentType) { |
return ".xhtml"; |
} |
- |
function getResourceURI(name, scheme, contentType) { |
var base = document.documentURI; |
if (base == null) { |
base = ""; |
} else { |
- base = base.substring(0, base.lastIndexOf('/') + 1) + "files/"; |
+ base = base.substring(0, base.lastIndexOf('/') + 1) + "files/"; |
} |
return base + name + getSuffix(contentType); |
} |
- |
- |
function startTest() { |
// |
@@ -709,19 +682,19 @@ if (window.testRunner) { |
// End WebKit modification |
// |
- // |
- // invoke test setup |
- // |
- setUpPage(); |
- try { |
- runTest(); |
- if (builder.initializationError == null) { |
- setResult(null, null); |
- } else { |
- setResult("skip", builder.initializationError); |
- } |
- } catch(ex) { |
- if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") { |
+ // |
+ // invoke test setup |
+ // |
+ setUpPage(); |
+ try { |
+ runTest(); |
+ if (builder.initializationError == null) { |
+ setResult(null, null); |
+ } else { |
+ setResult("skip", builder.initializationError); |
+ } |
+ } catch(ex) { |
+ if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") { |
setResult("failure", ex.substring(8)); |
} else { |
setResult("error", ex); |
@@ -738,6 +711,6 @@ if (window.testRunner) { |
} |
// |
// End WebKit modification |
-// |
+// |
} |