diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/tests/mochitest/dom-level1-core | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/tests/mochitest/dom-level1-core')
550 files changed, 80487 insertions, 0 deletions
diff --git a/dom/tests/mochitest/dom-level1-core/DOMTestCase.js b/dom/tests/mochitest/dom-level1-core/DOMTestCase.js new file mode 100644 index 0000000000..3c5aed5056 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/DOMTestCase.js @@ -0,0 +1,699 @@ +/* +Copyright (c) 2001-2005 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed 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. +See W3C License http://www.w3.org/Consortium/Legal/ for more details. +*/ + +function assertNull(descr, actual) { + return ok(actual === null, descr); +} + + +function assertNotNull(descr, actual) { + return ok(actual !== null, descr); +} + +function assertTrue(descr, actual) { + return ok(actual === true, descr); +} + +function assertFalse(descr, actual) { + return ok(actual === false, descr); +} + +function assertEquals(descr, expected, actual) { + return is(expected, actual, descr); +} + + function assertSize(descr, expected, actual) { + ok(actual !== null, descr); + // Work around too strict checks. + if (!actual) { + ok(actual, "[assertSize()] 'actual' has a value"); + return; + } + + is(actual.length, expected, descr); + } + + function assertEqualsAutoCase(context, descr, expected, actual) { + if (builder.contentType == "text/html") { + if(context == "attribute") { + is(actual.toLowerCase(), expected.toLowerCase(), descr); + } else { + is(actual, expected.toUpperCase(), descr); + } + } else { + is(expected, actual, descr); + } + } + + + function assertEqualsCollectionAutoCase(context, descr, expected, actual) { + // + // if they aren't the same size, they aren't equal + is(actual.length, expected.length, descr); + + // + // if there length is the same, then every entry in the expected list + // must appear once and only once in the actual list + var expectedLen = expected.length; + var expectedValue; + var actualLen = actual.length; + var i; + var j; + var matches; + for(i = 0; i < expectedLen; i++) { + 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(matches == 0) { + ok(false, descr + ": No match found for " + expectedValue); + } + if(matches > 1) { + ok(false, descr + ": Multiple matches found for " + expectedValue); + } + } + } + + function assertEqualsCollection(descr, expected, actual) { + // + // if they aren't the same size, they aren't equal + is(actual.length, expected.length, descr); + // + // if there length is the same, then every entry in the expected list + // must appear once and only once in the actual list + var expectedLen = expected.length; + var expectedValue; + var actualLen = actual.length; + var i; + var j; + var matches; + for(i = 0; i < expectedLen; i++) { + matches = 0; + expectedValue = expected[i]; + for(j = 0; j < actualLen; j++) { + if(expectedValue == actual[j]) { + matches++; + } + } + if(matches == 0) { + ok(false, descr + ": No match found for " + expectedValue); + } + if(matches > 1) { + ok(false, descr + ": Multiple matches found for " + expectedValue); + } + } + } + + + function assertEqualsListAutoCase(context, descr, expected, actual) { + 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]); + } + // + // if they aren't the same size, they aren't equal + is(actual.length, expected.length, descr); + } + + + function assertEqualsList(descr, expected, actual) { + var minLength = expected.length; + if (actual.length < minLength) { + minLength = actual.length; + } + // + for(var i = 0; i < minLength; i++) { + if(expected[i] != actual[i]) { + is(actual[i], expected[i], descr); + } + } + // + // if they aren't the same size, they aren't equal + is(actual.length, expected.length, descr); + } + + function assertInstanceOf(descr, type, obj) { + if(type == "Attr") { + is(2, obj.nodeType, descr); + var specd = obj.specified; + } +/* + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_is(type, "Attr", "[DOMTestCase.assertInstanceOf()] Fake default check."); + } +*/ + } + + function assertSame(descr, expected, actual) { + if(expected != actual) { + is(expected.nodeType, actual.nodeType, descr); + is(expected.nodeValue, actual.nodeValue, descr); + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(expected, actual, "[DOMTestCase.assertSame()] Fake default check." + + " (Type=" + actual.nodeType + ", Value=" + actual.nodeValue + ")"); + } + } + + function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) { + // + // URI must be non-null + ok(assertID, "[assertURIEquals()] 'assertID' has a value"); + ok(actual, "[assertURIEquals()] 'actual' has a value"); +/* + // Add missing early return. + if (!actual) + return; +*/ + + var uri = actual; + + var lastPound = actual.lastIndexOf("#"); + var actualFragment = ""; + if(lastPound != -1) { + // + // substring before pound + // + uri = actual.substring(0,lastPound); + actualFragment = actual.substring(lastPound+1); + } + if(fragment != null) is(actualFragment, fragment, assertID); + + var lastQuestion = uri.lastIndexOf("?"); + var actualQuery = ""; + if(lastQuestion != -1) { + // + // substring before pound + // + uri = actual.substring(0,lastQuestion); + actualQuery = actual.substring(lastQuestion+1); + } + if(query != null) is(actualQuery, query, assertID); + + var firstColon = uri.indexOf(":"); + var firstSlash = uri.indexOf("/"); + var actualPath = uri; + var actualScheme = ""; + if(firstColon != -1 && firstColon < firstSlash) { + actualScheme = uri.substring(0,firstColon); + actualPath = uri.substring(firstColon + 1); + } + + if(scheme != null) { + is(scheme, actualScheme, assertID); + } + + if(path != null) { + is(path, actualPath, assertID); + } + + if(host != null) { + var actualHost = ""; + if(actualPath.substring(0,2) == "//") { + var termSlash = actualPath.substring(2).indexOf("/") + 2; + actualHost = actualPath.substring(0,termSlash); + } + is(actualHost, host, assertID); + } + + if(file != null || name != null) { + var actualFile = actualPath; + var finalSlash = actualPath.lastIndexOf("/"); + if(finalSlash != -1) { + actualFile = actualPath.substring(finalSlash+1); + } + if (file != null) { + is(actualFile, file, assertID); + } + if (name != null) { + var actualName = actualFile; + var finalDot = actualFile.lastIndexOf("."); + if (finalDot != -1) { + actualName = actualName.substring(0, finalDot); + } + is(actualName, name, assertID); + } + } + + if(isAbsolute != null) { + is(actualPath.substring(0,1) == "/", isAbsolute, assertID); + } + } + + +// size() used by assertSize element +function size(collection) +{ + return collection.length; +} + +function same(expected, actual) +{ + return expected === actual; +} + +function getSuffix(contentType) { + switch(contentType) { + case "text/html": + return ".html"; + + 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 equalsAutoCase(context, expected, actual) { + if (builder.contentType == "text/html") { + if (context == "attribute") { + return expected.toLowerCase() == actual; + } + return expected.toUpperCase() == actual; + } + return expected == actual; +} + +function catchInitializationError(blder, ex) { + if (blder == null) { + alert(ex); + } else { + blder.initializationError = ex; + blder.initializationFatalError = ex; + } +} + +function checkInitialization(blder, testname) { + if (blder.initializationError != null) { + // Fake a "warn()" function, as it was missing :-| + function warn(msg) { + info("[checkInitialization() warning] " + msg); + } + + if (blder.skipIncompatibleTests) { + warn(testname + " not run:" + blder.initializationError); + return blder.initializationError; + } else { + // + // if an exception was thrown + // rethrow it and do not run the test + if (blder.initializationFatalError != null) { + throw blder.initializationFatalError; + } else { + // + // might be recoverable, warn but continue the test + warn(testname + ": " + blder.initializationError); + } + } + } + return null; +} +function createTempURI(scheme) { + if (scheme == "http") { + 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(); + this.capturedEvents = new Array(); + this.allEvents = new Array(); +} + +EventMonitor.prototype.handleEvent = function(evt) { + switch(evt.eventPhase) { + case 1: + monitor.capturedEvents[monitor.capturedEvents.length] = evt; + break; + + case 2: + monitor.atEvents[monitor.atEvents.length] = evt; + break; + + case 3: + monitor.bubbledEvents[monitor.bubbledEvents.length] = evt; + break; + } + monitor.allEvents[monitor.allEvents.length] = evt; +} + +function DOMErrorImpl(err) { + this.severity = err.severity; + this.message = err.message; + this.type = err.type; + this.relatedException = err.relatedException; + this.relatedData = err.relatedData; + this.location = err.location; +} + + + +function DOMErrorMonitor() { + this.allErrors = new Array(); +} + +DOMErrorMonitor.prototype.handleError = function(err) { + errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err); +} + +DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) { + var i; + for (i = 0; i < errorMonitor.allErrors.length; i++) { + if (errorMonitor.allErrors[i].severity >= severity) { + assertEquals(id, severity - 1, errorMonitor.allErrors[i].severity); + } + } +} + +function UserDataNotification(operation, key, data, src, dst) { + this.operation = operation; + this.key = key; + this.data = data; + this.src = src; + this.dst = dst; +} + +function UserDataMonitor() { + this.allNotifications = new Array(); +} + +UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) { + userDataMonitor.allNotifications[this.allNotifications.length] = + new UserDataNotification(operation, key, data, src, dst); +} + + + +function IFrameBuilder() { + this.contentType = "text/html"; + this.supportedContentTypes = [ "text/html", + "text/xml", + "image/svg+xml", + "application/xhtml+xml" ]; + + this.supportsAsyncChange = false; + this.async = true; + this.fixedAttributeNames = [ + "validating", "expandEntityReferences", "coalescing", + "signed", "hasNullString", "ignoringElementContentWhitespace", "namespaceAware", "ignoringComments", "schemaValidating"]; + + this.fixedAttributeValues = [false, true, false, true, true , false, false, true, false ]; + this.configurableAttributeNames = [ ]; + this.configurableAttributeValues = [ ]; + this.initializationError = null; + this.initializationFatalError = null; + this.skipIncompatibleTests = false; +} + +IFrameBuilder.prototype.hasFeature = function(feature, version) { + return document.implementation.hasFeature(feature, version); +} + +IFrameBuilder.prototype.getImplementation = function() { + return document.implementation; +} + +IFrameBuilder.prototype.setContentType = function(contentType) { + this.contentType = contentType; + if (contentType == "text/html") { + this.fixedAttributeValues[6] = false; + } else { + this.fixedAttributeValues[6] = true; + } +} + + + +IFrameBuilder.prototype.preload = function(frame, varname, url) { + var suffix; + if (this.contentType == "text/html" || this.contentType == "application/xhtml+xml") { + if (url.substring(0,5) == "staff" || url == "nodtdstaff" || url == "datatype_normalization") { + suffix = ".xml"; + } + } + + if (!suffix) suffix = getSuffix(this.contentType); + + var iframe = document.createElement("iframe"); + var srcname = url + suffix; + iframe.setAttribute("name", srcname); + iframe.setAttribute("src", fileBase + srcname); + // + // HTML and XHTML have onload attributes that will invoke loadComplete + // + if (suffix.indexOf("html") < 0) { + iframe.addEventListener("load", loadComplete, false); + } + document.getElementsByTagName("body").item(0).appendChild(iframe); + return 0; +} + +IFrameBuilder.prototype.load = function(frame, varname, url) { + var suffix; + if (url.substring(0,5) == "staff" || url == "nodtdstaff" || url == "datatype_normalization") { + suffix = ".xml"; + } + if (!suffix) suffix = getSuffix(this.contentType); + var name = url + suffix; + var iframes = document.getElementsByTagName("iframe"); + for(var i = 0; i < iframes.length; i++) { + if (iframes.item(i).getAttribute("name") == name) { + var item = iframes.item(i); + if (typeof(item.contentDocument) != 'undefined') { + return item.contentDocument; + } + if (typeof(item.document) != 'undefined') { + return item.document; + } + return null; + } + } + return null; +} + +IFrameBuilder.prototype.getImplementationAttribute = function(attr) { + for (var i = 0; i < this.fixedAttributeNames.length; i++) { + if (this.fixedAttributeNames[i] == attr) { + return this.fixedAttributeValues[i]; + } + } + throw "Unrecognized implementation attribute: " + attr; +} + + + +IFrameBuilder.prototype.setImplementationAttribute = function(attribute, value) { + var supported = this.getImplementationAttribute(attribute); + if (supported != value) { + this.initializationError = "IFrame loader does not support " + attribute + "=" + value; + } +} + + +IFrameBuilder.prototype.canSetImplementationAttribute = function(attribute, value) { + var supported = this.getImplementationAttribute(attribute); + return (supported == value); +} + + +function createBuilder(implementation) { + if (implementation == null) { + return new IFrameBuilder(); + } + switch(implementation) { +/* case "msxml3": + return new MSXMLBuilder("Msxml2.DOMDocument.3.0"); + + case "msxml4": + return new MSXMLBuilder("Msxml2.DOMDocument.4.0");*/ + + case "mozillaXML": + return new MozillaXMLBuilder(); +/* + case "svgplugin": + return new SVGPluginBuilder(); + + case "dom3ls": + return new DOM3LSBuilder(); */ + + case "iframe": + return new IFrameBuilder(); + + case "xmlhttprequest": + return new XMLHttpRequestBuilder(); + + default: + alert ("unrecognized implementation " + implementation); + } + return new IFrameBuilder(); +} + +function checkFeature(feature, version) +{ + if (!builder.hasFeature(feature, version)) + { + // + // don't throw exception so that users can select to ignore the precondition + // + builder.initializationError = "builder does not support feature " + feature + " version " + version; + } +} + +function createConfiguredBuilder() { + var builder = null; + var contentType = null; + var i; + var contentTypeSet = false; + var parm = null; + builder = new IFrameBuilder(); + return builder; +} + + +function preload(frame, varname, url) { + return builder.preload(frame, varname, url); +} + +function load(frame, varname, url) { + return builder.load(frame, varname, url); +} + +function getImplementationAttribute(attr) { + return builder.getImplementationAttribute(attr); +} + + +function setImplementationAttribute(attribute, value) { + builder.setImplementationAttribute(attribute, value); +} + +function setAsynchronous(value) { + if (builder.supportsAsyncChange) { + builder.async = value; + } else { + update(); + } +} + + +function createXPathEvaluator(doc) { + try { + return doc.getFeature("XPath", null); + } + catch(ex) { + } + return doc; +} + +function toLowerArray(src) { + var newArray = new Array(); + var i; + for (i = 0; i < src.length; i++) { + newArray[i] = src[i].toLowerCase(); + } + return newArray; +} + +function MSXMLBuilder_onreadystatechange() { + if (builder.parser.readyState == 4) { + loadComplete(); + } +} + + + +var fileBase = location.href; +if (fileBase.indexOf('?') != -1) { + fileBase = fileBase.substring(0, fileBase.indexOf('?')); +} +fileBase = fileBase.substring(0, fileBase.lastIndexOf('/') + 1) + "files/"; + +function getResourceURI(name, scheme, contentType) { + return fileBase + name + getSuffix(contentType); +} + + +function getImplementation() { + return builder.getImplementation(); +} + +// Count of failures overridden as todos. +var gFailuresAsTodos = 0; + +// Override SimpleTest result logger. +var ST_logResult = SimpleTest._logResult; +SimpleTest._logResult = function overrideSTlR(test, passString, failString) { + if (todoTests[docName] && !test.result && !test.todo) { + test.name = "[failure as todo] " + test.name; + test.todo = true; + failString = "TEST-KNOWN-FAIL"; + + ++gFailuresAsTodos; + } + + ST_logResult(test, passString, failString); +} + +// Actual marking code is in overrideSTlR() now. +function markTodos() { + if (todoTests[docName]) { + isnot(gFailuresAsTodos, 0, "test marked todo should have failed somewhere"); + } +} + +function runJSUnitTests() { + try { + var tests = exposeTestFunctionNames(); + for (var i = 0; i < tests.length; i++) { + window[tests[i]](); + } + } catch (ex) { + if (todoTests[docName]) { + todo(false, "[failure as todo] Test threw exception: " + ex); + ++gFailuresAsTodos; + } else { + ok(false, "Test threw exception: " + ex); + } + } +} diff --git a/dom/tests/mochitest/dom-level1-core/activity-home.css b/dom/tests/mochitest/dom-level1-core/activity-home.css new file mode 100644 index 0000000000..a68242d4fd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/activity-home.css @@ -0,0 +1,127 @@ +/* Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved. + The following software licensing rules apply: + http://www.w3.org/Consortium/Legal/copyright-software */ + +/* $Id: activity-home.css,v 1.4 2003/01/17 22:44:17 slesch Exp $ */ + +/* Single style sheet for ALL activity Home pages please +** Tim +** We need consistency on our web site - Nov 99 AC meeting +** Please do NOT use in-line style. +** Discuss this style sheet with other users and me +** before fixing it +*/ + +/* These bits from Dave's inline stylein the HTML home page + tbl 19991115 +*/ + + body { + margin-left: 10%; + margin-right: 5%; + font-family: sans-serif + } + h1 { margin-left: -8% } + h2 { margin-left: -4% } + h2 { color: #990066} + h3 { color: black } + pre { color: green; font-weight: bold } + em { font-style: italic; font-weight: bold } + strong { text-transform: uppercase; font-weight: bold } + b { color:#990066} + + td { background: #FFBFBF } + th { background: #A0A0A4 } + caption { text-decoration: underline; margin-top: 1em } + .splash { color: #009966} + p.banner { margin-left: -4% } + b.black { color: black} + b.pink {color:#990066} /* gimme a break -tbl */ + p.pink {color:#990066} /* sep of form and content?! */ + + blockquote { color: black; font-style:italic; + font-family: "Comic Sans MS", sans-serif;} + pre { font-family: monospace } + div.disclaimer {margin-left: -8%} + div.color { + background: rgb(255,204,255); + padding: 0.5em; + border: none + } + + + h3.c3 {text-align: center} + p.c2 {text-align: center} + h1.c1 {text-align: left} + +/* These bits from Chris L's inline style in the + Graphics home page + tbl 19991115 +*/ + +body { + background: white; color: black; +/* font-family: serif; WinIE 4 to 5.5 problem with generic serif 20010726 */ +} + +div.main { + margin-left: 5%; margin-right: 2% +} +h1, h2, h3 { + font-family: arial, helvetica, sans-serif +} +h2 { + margin-left:-2% +} +.date {color: #000; background: #DFD; font-style: italic; font-weight: bold; +vertical-align: top; border: none} +.format { + color: #000; + background: #DFD; + font-style: italic; + font-weight: bold; + vertical-align: top; + border: none +} + +td { + margin: 6px +} + +.offsite:link { + color: #393 +} + +.offsite:visited { + color: #666 +} +.newslist { + margin: 3px 8px +} + +pre { + font-family: Syntax, "Courier New", Courier, monospace +} + +.qdlogo { + height: 48px; + color: #903; + + /* border: thin solid #903; + */ font-weight: bold; font-family: Hattenschweiller, Impact, serif; vertical-align: middle + +} + +.filler { + color: #777; + font-style: italic +} + + + + + + + + + diff --git a/dom/tests/mochitest/dom-level1-core/exclusions.js b/dom/tests/mochitest/dom-level1-core/exclusions.js new file mode 100644 index 0000000000..d846a8a8eb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/exclusions.js @@ -0,0 +1,97 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +// tests that depend on DTD features no one cares about +var dtdTests = ["attrdefaultvalue","attrnotspecifiedvalue", "attrremovechild1", + "attrreplacechild1", "attrsetvaluenomodificationallowederr", + "attrsetvaluenomodificationallowederrEE", "attrspecifiedvalueremove", + "characterdataappenddatanomodificationallowederr", "characterdataappenddatanomodificationallowederrEE", + "characterdatadeletedatanomodificationallowederr", "characterdatadeletedatanomodificationallowederrEE", + "characterdatainsertdatanomodificationallowederr", "characterdatainsertdatanomodificationallowederrEE", + "characterdatareplacedatanomodificationallowederr", "characterdatareplacedatanomodificationallowederrEE", + "characterdatasetdatanomodificationallowederr", "characterdatasetdatanomodificationallowederrEE", + "documentcreateelementdefaultattr", "documentcreateentityreference", "documentcreateentityreferenceknown", + "documenttypegetentities", "documenttypegetentitieslength", "documenttypegetentitiestype", + "documenttypegetnotations", "documenttypegetnotationstype", "elementremoveattribute", + "elementremoveattributenodenomodificationallowederr", "elementremoveattributenodenomodificationallowederrEE", + "elementremoveattributenomodificationallowederr", "elementremoveattributenomodificationallowederrEE", + "elementremoveattributerestoredefaultvalue", "elementretrieveallattributes", + "elementsetattributenodenomodificationallowederr", "elementsetattributenodenomodificationallowederrEE", + "elementsetattributenomodificationallowederr", "elementsetattributenomodificationallowederrEE", + "entitygetentityname", "entitygetpublicid", "entitygetpublicidnull", "namednodemapremovenameditem", + "namednodemapremovenameditemgetvalue", "nodeappendchildnomodificationallowederr", "nodeappendchildnomodificationallowederrEE", + "nodeentitynodeattributes", "nodeentitynodename", "nodeentitynodetype", "nodeentitynodevalue", + "nodeentityreferencenodeattributes", "nodeentityreferencenodename", "nodeentityreferencenodetype", + "nodeentityreferencenodevalue", "nodeentitysetnodevalue", "nodeinsertbeforenomodificationallowederr", + "nodeinsertbeforenomodificationallowederrEE", "nodenotationnodeattributes", "nodenotationnodename", + "nodenotationnodetype", "nodenotationnodevalue", "noderemovechildnomodificationallowederr", + "noderemovechildnomodificationallowederrEE", "nodereplacechildnomodificationallowederr", + "nodereplacechildnomodificationallowederrEE", "nodesetnodevaluenomodificationallowederr", + "nodesetnodevaluenomodificationallowederrEE", "nodevalue03","nodevalue07", "nodevalue08", + "notationgetnotationname", "notationgetpublicid", "notationgetpublicidnull", "notationgetsystemid", + "notationgetsystemidnull", "processinginstructionsetdatanomodificationallowederr", + "processinginstructionsetdatanomodificationallowederrEE", "textsplittextnomodificationallowederr", + "textsplittextnomodificationallowederrEE"]; + +// we don't pass these, unfortunately +var indexErrTests = ["characterdataindexsizeerrdeletedatacountnegative", "characterdataindexsizeerrreplacedatacountnegative", + "characterdataindexsizeerrsubstringcountnegative", "hc_characterdataindexsizeerrdeletedatacountnegative", + "hc_characterdataindexsizeerrreplacedatacountnegative", "hc_characterdataindexsizeerrsubstringcountnegative"]; + +var attributeModTests = ["hc_attrappendchild1", "hc_attrappendchild3", "hc_attrappendchild5", + "hc_attrappendchild6", "hc_attrchildnodes2", "hc_attrclonenode1", "hc_attrinsertbefore1", + "hc_attrinsertbefore2", "hc_attrinsertbefore3", "hc_attrinsertbefore4", "hc_attrinsertbefore6", + "hc_attrnormalize", "hc_attrreplacechild1", "hc_attrreplacechild2", + "hc_attrsetvalue2", "hc_elementnormalize2", "hc_elementnotfounderr", "hc_elementremoveattribute", "hc_elementnormalize2", + "hc_elementnotfounderr", "hc_elementremoveattribute", + "hc_attrchildnodes1", "hc_attrfirstchild", + "hc_attrhaschildnodes", "hc_attrlastchild", + "hc_attrremovechild1", "hc_attrsetvalue1"]; +var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument", "hc_nodeinsertbeforenewchilddiffdocument", + "hc_nodereplacechildnewchilddiffdocument", "hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument", + "hc_nodeinsertbeforenewchilddiffdocument", "hc_nodereplacechildnewchilddiffdocument", "elementwrongdocumenterr", "namednodemapwrongdocumenterr", + "nodeappendchildnewchilddiffdocument", "nodeinsertbeforenewchilddiffdocument", "nodereplacechildnewchilddiffdocument"]; +// These tests rely on an implementation of document.createEntityReference. +var createEntityRef = ["documentinvalidcharacterexceptioncreateentref", + "documentinvalidcharacterexceptioncreateentref1", + "hc_attrgetvalue2", "hc_nodevalue03"]; +var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi", + "documentinvalidcharacterexceptioncreatepi1"]; +// These tests expect Node.attributes to exist. +var attributesOnNode = [ + "hc_commentgetcomment", + "hc_documentgetdoctype", + "hc_nodeattributenodeattribute", + "hc_nodecommentnodeattributes", + "hc_nodecommentnodeattributes", + "hc_nodedocumentfragmentnodevalue", + "hc_nodedocumentnodeattribute", + "hc_nodetextnodeattribute", + "nodeattributenodeattribute", + "nodecommentnodeattributes", + "nodecommentnodeattributes", + "nodedocumentfragmentnodevalue", + "nodedocumentnodeattribute", + "nodeprocessinginstructionnodeattributes", + "nodetextnodeattribute", + "nodecdatasectionnodeattribute", + "nodedocumenttypenodevalue" +] + +var todoTests = {}; +function concat(lst/*...*/) { + var f = []; + if (arguments !== null) { + f = arguments[0]; + } + for (var i = 1; i < arguments.length; i++) { + f = f.concat(arguments[i]); + } + return f; +} +var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef, createProcessingInstructionHTML, attributesOnNode); +for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; } diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html new file mode 100644 index 0000000000..f98d0be115 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.html @@ -0,0 +1,10 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()"> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> +</body></html> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg new file mode 100644 index 0000000000..89f26f6c76 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.svg @@ -0,0 +1,10 @@ +<svg xmlns='http://www.w3.org/2000/svg'><rect x="0" y="0" width="100" height="100"/><head xmlns='http://www.w3.org/1999/xhtml'><title>hc_nodtdstaff</title></head><body xmlns='http://www.w3.org/1999/xhtml'> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> +</body></svg> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml new file mode 100644 index 0000000000..8a5d8a8621 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xhtml @@ -0,0 +1,10 @@ +<html xmlns="http://www.w3.org/1999/xhtml"><head><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()"> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> +</body></html> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml new file mode 100644 index 0000000000..85c06931d8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_nodtdstaff.xml @@ -0,0 +1,10 @@ +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()"> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> +</body></html> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.html b/dom/tests/mochitest/dom-level1-core/files/hc_staff.html new file mode 100644 index 0000000000..9acf750493 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd" > +<!-- This is comment number 1.--> +<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_staff</title><script type="text/javascript" src="svgunit.js"></script><script charset="UTF-8" type="text/javascript" src="svgtest.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()"> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> + <p> + <em>EMP0002</em> + <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2; +This is an adjacent CDATASection with a reference to a tab &tab;</strong> + <code>Secretary</code> + <sup>35,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yes">β Dallas, γ + 98554</acronym> + </p> + <p> + <em>EMP0003</em> + <strong>Roger + Jones</strong> + <code>Department Manager</code> + <sup>100,000</sup> + <var>δ</var> + <acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym> + </p> + <p> + <em>EMP0004</em> + <strong>Jeny Oconnor</strong> + <code>Personnel Director</code> + <sup>95,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yα">27 South Road. Dallas, Texas 98556</acronym> + </p> + <p> + <em>EMP0005</em> + <strong>Robert Myers</strong> + <code>Computer Specialist</code> + <sup>90,000</sup> + <var>male</var> + <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym> + </p> +</body></html> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.svg b/dom/tests/mochitest/dom-level1-core/files/hc_staff.svg new file mode 100644 index 0000000000..cd0cc47f9a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.svg @@ -0,0 +1,72 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE svg + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "xhtml1-strict.dtd" [ + <!ENTITY alpha "α"> + <!ENTITY beta "β"> + <!ENTITY gamma "γ"> + <!ENTITY delta "δ"> + <!ENTITY epsilon "ε"> + <!ENTITY alpha "ζ"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> + <!ATTLIST acronym dir CDATA "ltr"> + <!ATTLIST head xmlns CDATA #IMPLIED> + <!ATTLIST body xmlns CDATA #IMPLIED> + <!ELEMENT svg (rect, script, head, body)> + <!ATTLIST svg xmlns CDATA #IMPLIED> + <!ELEMENT rect EMPTY> + <!ATTLIST rect + x CDATA #IMPLIED + y CDATA #IMPLIED + width CDATA #IMPLIED + height CDATA #IMPLIED> + <!ENTITY svgunit SYSTEM "svgunit.js"> + <!ENTITY svgtest SYSTEM "svgtest.js"> +]> +<!-- This is comment number 1.--> +<svg xmlns='http://www.w3.org/2000/svg'><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgtest;&svgunit;</script><head xmlns='http://www.w3.org/1999/xhtml'><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title></head><body xmlns='http://www.w3.org/1999/xhtml'> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> + <p> + <em>EMP0002</em> + <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2; +This is an adjacent CDATASection with a reference to a tab &tab;</strong> + <code>Secretary</code> + <sup>35,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yes">β Dallas, γ + 98554</acronym> + </p> + <p> + <em>EMP0003</em> + <strong>Roger + Jones</strong> + <code>Department Manager</code> + <sup>100,000</sup> + <var>δ</var> + <acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym> + </p> + <p> + <em>EMP0004</em> + <strong>Jeny Oconnor</strong> + <code>Personnel Director</code> + <sup>95,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yα">27 South Road. Dallas, Texas 98556</acronym> + </p> + <p> + <em>EMP0005</em> + <strong>Robert Myers</strong> + <code>Computer Specialist</code> + <sup>90,000</sup> + <var>male</var> + <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym> + </p> +</body></svg> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml new file mode 100644 index 0000000000..16d4eb0958 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xhtml @@ -0,0 +1,60 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "xhtml1-strict.dtd" [ + <!ENTITY alpha "α"> + <!ENTITY beta "β"> + <!ENTITY gamma "γ"> + <!ENTITY delta "δ"> + <!ENTITY epsilon "ε"> + <!ENTITY alpha "ζ"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> + <!ATTLIST acronym dir CDATA "ltr"> +]> +<!-- This is comment number 1.--> +<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()"> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> + <p> + <em>EMP0002</em> + <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2; +This is an adjacent CDATASection with a reference to a tab &tab;</strong> + <code>Secretary</code> + <sup>35,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yes">β Dallas, γ + 98554</acronym> + </p> + <p> + <em>EMP0003</em> + <strong>Roger + Jones</strong> + <code>Department Manager</code> + <sup>100,000</sup> + <var>δ</var> + <acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym> + </p> + <p> + <em>EMP0004</em> + <strong>Jeny Oconnor</strong> + <code>Personnel Director</code> + <sup>95,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yα">27 South Road. Dallas, Texas 98556</acronym> + </p> + <p> + <em>EMP0005</em> + <strong>Robert Myers</strong> + <code>Computer Specialist</code> + <sup>90,000</sup> + <var>male</var> + <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym> + </p> +</body></html> diff --git a/dom/tests/mochitest/dom-level1-core/files/hc_staff.xml b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xml new file mode 100644 index 0000000000..2df9a74154 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/hc_staff.xml @@ -0,0 +1,60 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "xhtml1-strict.dtd" [ + <!ENTITY alpha "α"> + <!ENTITY beta "β"> + <!ENTITY gamma "γ"> + <!ENTITY delta "δ"> + <!ENTITY epsilon "ε"> + <!ENTITY alpha "ζ"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> + <!ATTLIST acronym dir CDATA "ltr"> +]> +<!-- This is comment number 1.--> +<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()"> + <p> + <em>EMP0001</em> + <strong>Margaret Martin</strong> + <code>Accountant</code> + <sup>56,000</sup> + <var>Female</var> + <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> + </p> + <p> + <em>EMP0002</em> + <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2; +This is an adjacent CDATASection with a reference to a tab &tab;</strong> + <code>Secretary</code> + <sup>35,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yes">β Dallas, γ + 98554</acronym> + </p> + <p> + <em>EMP0003</em> + <strong>Roger + Jones</strong> + <code>Department Manager</code> + <sup>100,000</sup> + <var>δ</var> + <acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym> + </p> + <p> + <em>EMP0004</em> + <strong>Jeny Oconnor</strong> + <code>Personnel Director</code> + <sup>95,000</sup> + <var>Female</var> + <acronym title="Yes" class="Yα">27 South Road. Dallas, Texas 98556</acronym> + </p> + <p> + <em>EMP0005</em> + <strong>Robert Myers</strong> + <code>Computer Specialist</code> + <sup>90,000</sup> + <var>male</var> + <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym> + </p> +</body></html> diff --git a/dom/tests/mochitest/dom-level1-core/files/staff.dtd b/dom/tests/mochitest/dom-level1-core/files/staff.dtd new file mode 100644 index 0000000000..02a994d57d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/staff.dtd @@ -0,0 +1,17 @@ +<!ELEMENT employeeId (#PCDATA)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT position (#PCDATA)> +<!ELEMENT salary (#PCDATA)> +<!ELEMENT address (#PCDATA)> +<!ELEMENT entElement ( #PCDATA ) > +<!ELEMENT gender ( #PCDATA | entElement )* > +<!ELEMENT employee (employeeId, name, position, salary, gender, address) > +<!ELEMENT staff (employee)+> +<!ATTLIST entElement + attr1 CDATA "Attr"> +<!ATTLIST address + domestic CDATA #IMPLIED + street CDATA "Yes"> +<!ATTLIST entElement + domestic CDATA "MALE" > + diff --git a/dom/tests/mochitest/dom-level1-core/files/staff.svg b/dom/tests/mochitest/dom-level1-core/files/staff.svg new file mode 100644 index 0000000000..77c9b5bd2a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/staff.svg @@ -0,0 +1,72 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE svg SYSTEM "staff.dtd" [ + <!ENTITY ent1 "es"> + <!ENTITY ent2 "1900 Dallas Road"> + <!ENTITY ent3 "Texas"> + <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>"> + <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> + <!ENTITY ent1 "This entity should be discarded"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> + <!ATTLIST employee xmlns CDATA #IMPLIED> + <!ELEMENT svg (rect, script, employee+)> + <!ATTLIST svg + xmlns CDATA #FIXED "http://www.w3.org/2000/svg" + name CDATA #IMPLIED> + <!ELEMENT rect EMPTY> + <!ATTLIST rect + x CDATA #REQUIRED + y CDATA #REQUIRED + width CDATA #REQUIRED + height CDATA #REQUIRED> + <!ELEMENT script (#PCDATA)> + <!ATTLIST script type CDATA #IMPLIED> + <!ENTITY svgunit SYSTEM "svgunit.js"> + <!ENTITY svgtest SYSTEM "svgtest.js"> +]> +<!-- This is comment number 1.--> +<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/><script type="text/ecmascript">&svgunit;&svgtest;</script> + <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files"> + <employeeId>EMP0001</employeeId> + <name>Margaret Martin</name> + <position>Accountant</position> + <salary>56,000</salary> + <gender>Female</gender> + <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address> + </employee> + <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files"> + <employeeId>EMP0002</employeeId> + <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]> +<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name> + <position>Secretary</position> + <salary>35,000</salary> + <gender>Female</gender> + <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3; + 98554</address> + </employee> + <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files"> + <employeeId>EMP0003</employeeId> + <name>Roger + Jones</name> + <position>Department Manager</position> + <salary>100,000</salary> + <gender>&ent4;</gender> + <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address> + </employee> + <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files"> + <employeeId>EMP0004</employeeId> + <name>Jeny Oconnor</name> + <position>Personnel Director</position> + <salary>95,000</salary> + <gender>Female</gender> + <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address> + </employee> + <employee xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1/Files"> + <employeeId>EMP0005</employeeId> + <name>Robert Myers</name> + <position>Computer Specialist</position> + <salary>90,000</salary> + <gender>male</gender> + <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address> + </employee> + </svg> diff --git a/dom/tests/mochitest/dom-level1-core/files/staff.xml b/dom/tests/mochitest/dom-level1-core/files/staff.xml new file mode 100644 index 0000000000..f89c5107db --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/staff.xml @@ -0,0 +1,57 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE staff SYSTEM "staff.dtd" [ + <!ENTITY ent1 "es"> + <!ENTITY ent2 "1900 Dallas Road"> + <!ENTITY ent3 "Texas"> + <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>"> + <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> + <!ENTITY ent1 "This entity should be discarded"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> +]> +<!-- This is comment number 1.--> +<staff> + <employee> + <employeeId>EMP0001</employeeId> + <name>Margaret Martin</name> + <position>Accountant</position> + <salary>56,000</salary> + <gender>Female</gender> + <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address> + </employee> + <employee> + <employeeId>EMP0002</employeeId> + <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]> +<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name> + <position>Secretary</position> + <salary>35,000</salary> + <gender>Female</gender> + <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3; + 98554</address> + </employee> + <employee> + <employeeId>EMP0003</employeeId> + <name>Roger + Jones</name> + <position>Department Manager</position> + <salary>100,000</salary> + <gender>&ent4;</gender> + <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address> + </employee> + <employee> + <employeeId>EMP0004</employeeId> + <name>Jeny Oconnor</name> + <position>Personnel Director</position> + <salary>95,000</salary> + <gender>Female</gender> + <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address> + </employee> + <employee> + <employeeId>EMP0005</employeeId> + <name>Robert Myers</name> + <position>Computer Specialist</position> + <salary>90,000</salary> + <gender>male</gender> + <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address> + </employee> + </staff> diff --git a/dom/tests/mochitest/dom-level1-core/files/svgtest.js b/dom/tests/mochitest/dom-level1-core/files/svgtest.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/svgtest.js diff --git a/dom/tests/mochitest/dom-level1-core/files/svgunit.js b/dom/tests/mochitest/dom-level1-core/files/svgunit.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/svgunit.js diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent b/dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent new file mode 100644 index 0000000000..ffee223eb1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/xhtml-lat1.ent @@ -0,0 +1,196 @@ +<!-- Portions (C) International Organization for Standardization 1986 + Permission to copy in any form is granted for use with + conforming SGML systems and applications as defined in + ISO 8879, provided this notice is included in all copies. +--> +<!-- Character entity set. Typical invocation: + <!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"> + %HTMLlat1; +--> + +<!ENTITY nbsp " "> <!-- no-break space = non-breaking space, + U+00A0 ISOnum --> +<!ENTITY iexcl "¡"> <!-- inverted exclamation mark, U+00A1 ISOnum --> +<!ENTITY cent "¢"> <!-- cent sign, U+00A2 ISOnum --> +<!ENTITY pound "£"> <!-- pound sign, U+00A3 ISOnum --> +<!ENTITY curren "¤"> <!-- currency sign, U+00A4 ISOnum --> +<!ENTITY yen "¥"> <!-- yen sign = yuan sign, U+00A5 ISOnum --> +<!ENTITY brvbar "¦"> <!-- broken bar = broken vertical bar, + U+00A6 ISOnum --> +<!ENTITY sect "§"> <!-- section sign, U+00A7 ISOnum --> +<!ENTITY uml "¨"> <!-- diaeresis = spacing diaeresis, + U+00A8 ISOdia --> +<!ENTITY copy "©"> <!-- copyright sign, U+00A9 ISOnum --> +<!ENTITY ordf "ª"> <!-- feminine ordinal indicator, U+00AA ISOnum --> +<!ENTITY laquo "«"> <!-- left-pointing double angle quotation mark + = left pointing guillemet, U+00AB ISOnum --> +<!ENTITY not "¬"> <!-- not sign = angled dash, + U+00AC ISOnum --> +<!ENTITY shy "­"> <!-- soft hyphen = discretionary hyphen, + U+00AD ISOnum --> +<!ENTITY reg "®"> <!-- registered sign = registered trade mark sign, + U+00AE ISOnum --> +<!ENTITY macr "¯"> <!-- macron = spacing macron = overline + = APL overbar, U+00AF ISOdia --> +<!ENTITY deg "°"> <!-- degree sign, U+00B0 ISOnum --> +<!ENTITY plusmn "±"> <!-- plus-minus sign = plus-or-minus sign, + U+00B1 ISOnum --> +<!ENTITY sup2 "²"> <!-- superscript two = superscript digit two + = squared, U+00B2 ISOnum --> +<!ENTITY sup3 "³"> <!-- superscript three = superscript digit three + = cubed, U+00B3 ISOnum --> +<!ENTITY acute "´"> <!-- acute accent = spacing acute, + U+00B4 ISOdia --> +<!ENTITY micro "µ"> <!-- micro sign, U+00B5 ISOnum --> +<!ENTITY para "¶"> <!-- pilcrow sign = paragraph sign, + U+00B6 ISOnum --> +<!ENTITY middot "·"> <!-- middle dot = Georgian comma + = Greek middle dot, U+00B7 ISOnum --> +<!ENTITY cedil "¸"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia --> +<!ENTITY sup1 "¹"> <!-- superscript one = superscript digit one, + U+00B9 ISOnum --> +<!ENTITY ordm "º"> <!-- masculine ordinal indicator, + U+00BA ISOnum --> +<!ENTITY raquo "»"> <!-- right-pointing double angle quotation mark + = right pointing guillemet, U+00BB ISOnum --> +<!ENTITY frac14 "¼"> <!-- vulgar fraction one quarter + = fraction one quarter, U+00BC ISOnum --> +<!ENTITY frac12 "½"> <!-- vulgar fraction one half + = fraction one half, U+00BD ISOnum --> +<!ENTITY frac34 "¾"> <!-- vulgar fraction three quarters + = fraction three quarters, U+00BE ISOnum --> +<!ENTITY iquest "¿"> <!-- inverted question mark + = turned question mark, U+00BF ISOnum --> +<!ENTITY Agrave "À"> <!-- latin capital letter A with grave + = latin capital letter A grave, + U+00C0 ISOlat1 --> +<!ENTITY Aacute "Á"> <!-- latin capital letter A with acute, + U+00C1 ISOlat1 --> +<!ENTITY Acirc "Â"> <!-- latin capital letter A with circumflex, + U+00C2 ISOlat1 --> +<!ENTITY Atilde "Ã"> <!-- latin capital letter A with tilde, + U+00C3 ISOlat1 --> +<!ENTITY Auml "Ä"> <!-- latin capital letter A with diaeresis, + U+00C4 ISOlat1 --> +<!ENTITY Aring "Å"> <!-- latin capital letter A with ring above + = latin capital letter A ring, + U+00C5 ISOlat1 --> +<!ENTITY AElig "Æ"> <!-- latin capital letter AE + = latin capital ligature AE, + U+00C6 ISOlat1 --> +<!ENTITY Ccedil "Ç"> <!-- latin capital letter C with cedilla, + U+00C7 ISOlat1 --> +<!ENTITY Egrave "È"> <!-- latin capital letter E with grave, + U+00C8 ISOlat1 --> +<!ENTITY Eacute "É"> <!-- latin capital letter E with acute, + U+00C9 ISOlat1 --> +<!ENTITY Ecirc "Ê"> <!-- latin capital letter E with circumflex, + U+00CA ISOlat1 --> +<!ENTITY Euml "Ë"> <!-- latin capital letter E with diaeresis, + U+00CB ISOlat1 --> +<!ENTITY Igrave "Ì"> <!-- latin capital letter I with grave, + U+00CC ISOlat1 --> +<!ENTITY Iacute "Í"> <!-- latin capital letter I with acute, + U+00CD ISOlat1 --> +<!ENTITY Icirc "Î"> <!-- latin capital letter I with circumflex, + U+00CE ISOlat1 --> +<!ENTITY Iuml "Ï"> <!-- latin capital letter I with diaeresis, + U+00CF ISOlat1 --> +<!ENTITY ETH "Ð"> <!-- latin capital letter ETH, U+00D0 ISOlat1 --> +<!ENTITY Ntilde "Ñ"> <!-- latin capital letter N with tilde, + U+00D1 ISOlat1 --> +<!ENTITY Ograve "Ò"> <!-- latin capital letter O with grave, + U+00D2 ISOlat1 --> +<!ENTITY Oacute "Ó"> <!-- latin capital letter O with acute, + U+00D3 ISOlat1 --> +<!ENTITY Ocirc "Ô"> <!-- latin capital letter O with circumflex, + U+00D4 ISOlat1 --> +<!ENTITY Otilde "Õ"> <!-- latin capital letter O with tilde, + U+00D5 ISOlat1 --> +<!ENTITY Ouml "Ö"> <!-- latin capital letter O with diaeresis, + U+00D6 ISOlat1 --> +<!ENTITY times "×"> <!-- multiplication sign, U+00D7 ISOnum --> +<!ENTITY Oslash "Ø"> <!-- latin capital letter O with stroke + = latin capital letter O slash, + U+00D8 ISOlat1 --> +<!ENTITY Ugrave "Ù"> <!-- latin capital letter U with grave, + U+00D9 ISOlat1 --> +<!ENTITY Uacute "Ú"> <!-- latin capital letter U with acute, + U+00DA ISOlat1 --> +<!ENTITY Ucirc "Û"> <!-- latin capital letter U with circumflex, + U+00DB ISOlat1 --> +<!ENTITY Uuml "Ü"> <!-- latin capital letter U with diaeresis, + U+00DC ISOlat1 --> +<!ENTITY Yacute "Ý"> <!-- latin capital letter Y with acute, + U+00DD ISOlat1 --> +<!ENTITY THORN "Þ"> <!-- latin capital letter THORN, + U+00DE ISOlat1 --> +<!ENTITY szlig "ß"> <!-- latin small letter sharp s = ess-zed, + U+00DF ISOlat1 --> +<!ENTITY agrave "à"> <!-- latin small letter a with grave + = latin small letter a grave, + U+00E0 ISOlat1 --> +<!ENTITY aacute "á"> <!-- latin small letter a with acute, + U+00E1 ISOlat1 --> +<!ENTITY acirc "â"> <!-- latin small letter a with circumflex, + U+00E2 ISOlat1 --> +<!ENTITY atilde "ã"> <!-- latin small letter a with tilde, + U+00E3 ISOlat1 --> +<!ENTITY auml "ä"> <!-- latin small letter a with diaeresis, + U+00E4 ISOlat1 --> +<!ENTITY aring "å"> <!-- latin small letter a with ring above + = latin small letter a ring, + U+00E5 ISOlat1 --> +<!ENTITY aelig "æ"> <!-- latin small letter ae + = latin small ligature ae, U+00E6 ISOlat1 --> +<!ENTITY ccedil "ç"> <!-- latin small letter c with cedilla, + U+00E7 ISOlat1 --> +<!ENTITY egrave "è"> <!-- latin small letter e with grave, + U+00E8 ISOlat1 --> +<!ENTITY eacute "é"> <!-- latin small letter e with acute, + U+00E9 ISOlat1 --> +<!ENTITY ecirc "ê"> <!-- latin small letter e with circumflex, + U+00EA ISOlat1 --> +<!ENTITY euml "ë"> <!-- latin small letter e with diaeresis, + U+00EB ISOlat1 --> +<!ENTITY igrave "ì"> <!-- latin small letter i with grave, + U+00EC ISOlat1 --> +<!ENTITY iacute "í"> <!-- latin small letter i with acute, + U+00ED ISOlat1 --> +<!ENTITY icirc "î"> <!-- latin small letter i with circumflex, + U+00EE ISOlat1 --> +<!ENTITY iuml "ï"> <!-- latin small letter i with diaeresis, + U+00EF ISOlat1 --> +<!ENTITY eth "ð"> <!-- latin small letter eth, U+00F0 ISOlat1 --> +<!ENTITY ntilde "ñ"> <!-- latin small letter n with tilde, + U+00F1 ISOlat1 --> +<!ENTITY ograve "ò"> <!-- latin small letter o with grave, + U+00F2 ISOlat1 --> +<!ENTITY oacute "ó"> <!-- latin small letter o with acute, + U+00F3 ISOlat1 --> +<!ENTITY ocirc "ô"> <!-- latin small letter o with circumflex, + U+00F4 ISOlat1 --> +<!ENTITY otilde "õ"> <!-- latin small letter o with tilde, + U+00F5 ISOlat1 --> +<!ENTITY ouml "ö"> <!-- latin small letter o with diaeresis, + U+00F6 ISOlat1 --> +<!ENTITY divide "÷"> <!-- division sign, U+00F7 ISOnum --> +<!ENTITY oslash "ø"> <!-- latin small letter o with stroke, + = latin small letter o slash, + U+00F8 ISOlat1 --> +<!ENTITY ugrave "ù"> <!-- latin small letter u with grave, + U+00F9 ISOlat1 --> +<!ENTITY uacute "ú"> <!-- latin small letter u with acute, + U+00FA ISOlat1 --> +<!ENTITY ucirc "û"> <!-- latin small letter u with circumflex, + U+00FB ISOlat1 --> +<!ENTITY uuml "ü"> <!-- latin small letter u with diaeresis, + U+00FC ISOlat1 --> +<!ENTITY yacute "ý"> <!-- latin small letter y with acute, + U+00FD ISOlat1 --> +<!ENTITY thorn "þ"> <!-- latin small letter thorn, + U+00FE ISOlat1 --> +<!ENTITY yuml "ÿ"> <!-- latin small letter y with diaeresis, + U+00FF ISOlat1 --> diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent b/dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent new file mode 100644 index 0000000000..ca358b2fec --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/xhtml-special.ent @@ -0,0 +1,80 @@ +<!-- Special characters for XHTML --> + +<!-- Character entity set. Typical invocation: + <!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"> + %HTMLspecial; +--> + +<!-- Portions (C) International Organization for Standardization 1986: + Permission to copy in any form is granted for use with + conforming SGML systems and applications as defined in + ISO 8879, provided this notice is included in all copies. +--> + +<!-- Relevant ISO entity set is given unless names are newly introduced. + New names (i.e., not in ISO 8879 list) do not clash with any + existing ISO 8879 entity names. ISO 10646 character numbers + are given for each character, in hex. values are decimal + conversions of the ISO 10646 values and refer to the document + character set. Names are Unicode names. +--> + +<!-- C0 Controls and Basic Latin --> +<!ENTITY quot """> <!-- quotation mark, U+0022 ISOnum --> +<!ENTITY amp "&#38;"> <!-- ampersand, U+0026 ISOnum --> +<!ENTITY lt "&#60;"> <!-- less-than sign, U+003C ISOnum --> +<!ENTITY gt ">"> <!-- greater-than sign, U+003E ISOnum --> +<!ENTITY apos "'"> <!-- apostrophe = APL quote, U+0027 ISOnum --> + +<!-- Latin Extended-A --> +<!ENTITY OElig "Œ"> <!-- latin capital ligature OE, + U+0152 ISOlat2 --> +<!ENTITY oelig "œ"> <!-- latin small ligature oe, U+0153 ISOlat2 --> +<!-- ligature is a misnomer, this is a separate character in some languages --> +<!ENTITY Scaron "Š"> <!-- latin capital letter S with caron, + U+0160 ISOlat2 --> +<!ENTITY scaron "š"> <!-- latin small letter s with caron, + U+0161 ISOlat2 --> +<!ENTITY Yuml "Ÿ"> <!-- latin capital letter Y with diaeresis, + U+0178 ISOlat2 --> + +<!-- Spacing Modifier Letters --> +<!ENTITY circ "ˆ"> <!-- modifier letter circumflex accent, + U+02C6 ISOpub --> +<!ENTITY tilde "˜"> <!-- small tilde, U+02DC ISOdia --> + +<!-- General Punctuation --> +<!ENTITY ensp " "> <!-- en space, U+2002 ISOpub --> +<!ENTITY emsp " "> <!-- em space, U+2003 ISOpub --> +<!ENTITY thinsp " "> <!-- thin space, U+2009 ISOpub --> +<!ENTITY zwnj "‌"> <!-- zero width non-joiner, + U+200C NEW RFC 2070 --> +<!ENTITY zwj "‍"> <!-- zero width joiner, U+200D NEW RFC 2070 --> +<!ENTITY lrm "‎"> <!-- left-to-right mark, U+200E NEW RFC 2070 --> +<!ENTITY rlm "‏"> <!-- right-to-left mark, U+200F NEW RFC 2070 --> +<!ENTITY ndash "–"> <!-- en dash, U+2013 ISOpub --> +<!ENTITY mdash "—"> <!-- em dash, U+2014 ISOpub --> +<!ENTITY lsquo "‘"> <!-- left single quotation mark, + U+2018 ISOnum --> +<!ENTITY rsquo "’"> <!-- right single quotation mark, + U+2019 ISOnum --> +<!ENTITY sbquo "‚"> <!-- single low-9 quotation mark, U+201A NEW --> +<!ENTITY ldquo "“"> <!-- left double quotation mark, + U+201C ISOnum --> +<!ENTITY rdquo "”"> <!-- right double quotation mark, + U+201D ISOnum --> +<!ENTITY bdquo "„"> <!-- double low-9 quotation mark, U+201E NEW --> +<!ENTITY dagger "†"> <!-- dagger, U+2020 ISOpub --> +<!ENTITY Dagger "‡"> <!-- double dagger, U+2021 ISOpub --> +<!ENTITY permil "‰"> <!-- per mille sign, U+2030 ISOtech --> +<!ENTITY lsaquo "‹"> <!-- single left-pointing angle quotation mark, + U+2039 ISO proposed --> +<!-- lsaquo is proposed but not yet ISO standardized --> +<!ENTITY rsaquo "›"> <!-- single right-pointing angle quotation mark, + U+203A ISO proposed --> +<!-- rsaquo is proposed but not yet ISO standardized --> + +<!-- Currency Symbols --> +<!ENTITY euro "€"> <!-- euro sign, U+20AC NEW --> diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent b/dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent new file mode 100644 index 0000000000..63c2abfa6f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/xhtml-symbol.ent @@ -0,0 +1,237 @@ +<!-- Mathematical, Greek and Symbolic characters for XHTML --> + +<!-- Character entity set. Typical invocation: + <!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent"> + %HTMLsymbol; +--> + +<!-- Portions (C) International Organization for Standardization 1986: + Permission to copy in any form is granted for use with + conforming SGML systems and applications as defined in + ISO 8879, provided this notice is included in all copies. +--> + +<!-- Relevant ISO entity set is given unless names are newly introduced. + New names (i.e., not in ISO 8879 list) do not clash with any + existing ISO 8879 entity names. ISO 10646 character numbers + are given for each character, in hex. values are decimal + conversions of the ISO 10646 values and refer to the document + character set. Names are Unicode names. +--> + +<!-- Latin Extended-B --> +<!ENTITY fnof "ƒ"> <!-- latin small letter f with hook = function + = florin, U+0192 ISOtech --> + +<!-- Greek --> +<!ENTITY Alpha "Α"> <!-- greek capital letter alpha, U+0391 --> +<!ENTITY Beta "Β"> <!-- greek capital letter beta, U+0392 --> +<!ENTITY Gamma "Γ"> <!-- greek capital letter gamma, + U+0393 ISOgrk3 --> +<!ENTITY Delta "Δ"> <!-- greek capital letter delta, + U+0394 ISOgrk3 --> +<!ENTITY Epsilon "Ε"> <!-- greek capital letter epsilon, U+0395 --> +<!ENTITY Zeta "Ζ"> <!-- greek capital letter zeta, U+0396 --> +<!ENTITY Eta "Η"> <!-- greek capital letter eta, U+0397 --> +<!ENTITY Theta "Θ"> <!-- greek capital letter theta, + U+0398 ISOgrk3 --> +<!ENTITY Iota "Ι"> <!-- greek capital letter iota, U+0399 --> +<!ENTITY Kappa "Κ"> <!-- greek capital letter kappa, U+039A --> +<!ENTITY Lambda "Λ"> <!-- greek capital letter lamda, + U+039B ISOgrk3 --> +<!ENTITY Mu "Μ"> <!-- greek capital letter mu, U+039C --> +<!ENTITY Nu "Ν"> <!-- greek capital letter nu, U+039D --> +<!ENTITY Xi "Ξ"> <!-- greek capital letter xi, U+039E ISOgrk3 --> +<!ENTITY Omicron "Ο"> <!-- greek capital letter omicron, U+039F --> +<!ENTITY Pi "Π"> <!-- greek capital letter pi, U+03A0 ISOgrk3 --> +<!ENTITY Rho "Ρ"> <!-- greek capital letter rho, U+03A1 --> +<!-- there is no Sigmaf, and no U+03A2 character either --> +<!ENTITY Sigma "Σ"> <!-- greek capital letter sigma, + U+03A3 ISOgrk3 --> +<!ENTITY Tau "Τ"> <!-- greek capital letter tau, U+03A4 --> +<!ENTITY Upsilon "Υ"> <!-- greek capital letter upsilon, + U+03A5 ISOgrk3 --> +<!ENTITY Phi "Φ"> <!-- greek capital letter phi, + U+03A6 ISOgrk3 --> +<!ENTITY Chi "Χ"> <!-- greek capital letter chi, U+03A7 --> +<!ENTITY Psi "Ψ"> <!-- greek capital letter psi, + U+03A8 ISOgrk3 --> +<!ENTITY Omega "Ω"> <!-- greek capital letter omega, + U+03A9 ISOgrk3 --> + +<!ENTITY alpha "α"> <!-- greek small letter alpha, + U+03B1 ISOgrk3 --> +<!ENTITY beta "β"> <!-- greek small letter beta, U+03B2 ISOgrk3 --> +<!ENTITY gamma "γ"> <!-- greek small letter gamma, + U+03B3 ISOgrk3 --> +<!ENTITY delta "δ"> <!-- greek small letter delta, + U+03B4 ISOgrk3 --> +<!ENTITY epsilon "ε"> <!-- greek small letter epsilon, + U+03B5 ISOgrk3 --> +<!ENTITY zeta "ζ"> <!-- greek small letter zeta, U+03B6 ISOgrk3 --> +<!ENTITY eta "η"> <!-- greek small letter eta, U+03B7 ISOgrk3 --> +<!ENTITY theta "θ"> <!-- greek small letter theta, + U+03B8 ISOgrk3 --> +<!ENTITY iota "ι"> <!-- greek small letter iota, U+03B9 ISOgrk3 --> +<!ENTITY kappa "κ"> <!-- greek small letter kappa, + U+03BA ISOgrk3 --> +<!ENTITY lambda "λ"> <!-- greek small letter lamda, + U+03BB ISOgrk3 --> +<!ENTITY mu "μ"> <!-- greek small letter mu, U+03BC ISOgrk3 --> +<!ENTITY nu "ν"> <!-- greek small letter nu, U+03BD ISOgrk3 --> +<!ENTITY xi "ξ"> <!-- greek small letter xi, U+03BE ISOgrk3 --> +<!ENTITY omicron "ο"> <!-- greek small letter omicron, U+03BF NEW --> +<!ENTITY pi "π"> <!-- greek small letter pi, U+03C0 ISOgrk3 --> +<!ENTITY rho "ρ"> <!-- greek small letter rho, U+03C1 ISOgrk3 --> +<!ENTITY sigmaf "ς"> <!-- greek small letter final sigma, + U+03C2 ISOgrk3 --> +<!ENTITY sigma "σ"> <!-- greek small letter sigma, + U+03C3 ISOgrk3 --> +<!ENTITY tau "τ"> <!-- greek small letter tau, U+03C4 ISOgrk3 --> +<!ENTITY upsilon "υ"> <!-- greek small letter upsilon, + U+03C5 ISOgrk3 --> +<!ENTITY phi "φ"> <!-- greek small letter phi, U+03C6 ISOgrk3 --> +<!ENTITY chi "χ"> <!-- greek small letter chi, U+03C7 ISOgrk3 --> +<!ENTITY psi "ψ"> <!-- greek small letter psi, U+03C8 ISOgrk3 --> +<!ENTITY omega "ω"> <!-- greek small letter omega, + U+03C9 ISOgrk3 --> +<!ENTITY thetasym "ϑ"> <!-- greek theta symbol, + U+03D1 NEW --> +<!ENTITY upsih "ϒ"> <!-- greek upsilon with hook symbol, + U+03D2 NEW --> +<!ENTITY piv "ϖ"> <!-- greek pi symbol, U+03D6 ISOgrk3 --> + +<!-- General Punctuation --> +<!ENTITY bull "•"> <!-- bullet = black small circle, + U+2022 ISOpub --> +<!-- bullet is NOT the same as bullet operator, U+2219 --> +<!ENTITY hellip "…"> <!-- horizontal ellipsis = three dot leader, + U+2026 ISOpub --> +<!ENTITY prime "′"> <!-- prime = minutes = feet, U+2032 ISOtech --> +<!ENTITY Prime "″"> <!-- double prime = seconds = inches, + U+2033 ISOtech --> +<!ENTITY oline "‾"> <!-- overline = spacing overscore, + U+203E NEW --> +<!ENTITY frasl "⁄"> <!-- fraction slash, U+2044 NEW --> + +<!-- Letterlike Symbols --> +<!ENTITY weierp "℘"> <!-- script capital P = power set + = Weierstrass p, U+2118 ISOamso --> +<!ENTITY image "ℑ"> <!-- black-letter capital I = imaginary part, + U+2111 ISOamso --> +<!ENTITY real "ℜ"> <!-- black-letter capital R = real part symbol, + U+211C ISOamso --> +<!ENTITY trade "™"> <!-- trade mark sign, U+2122 ISOnum --> +<!ENTITY alefsym "ℵ"> <!-- alef symbol = first transfinite cardinal, + U+2135 NEW --> +<!-- alef symbol is NOT the same as hebrew letter alef, + U+05D0 although the same glyph could be used to depict both characters --> + +<!-- Arrows --> +<!ENTITY larr "←"> <!-- leftwards arrow, U+2190 ISOnum --> +<!ENTITY uarr "↑"> <!-- upwards arrow, U+2191 ISOnum--> +<!ENTITY rarr "→"> <!-- rightwards arrow, U+2192 ISOnum --> +<!ENTITY darr "↓"> <!-- downwards arrow, U+2193 ISOnum --> +<!ENTITY harr "↔"> <!-- left right arrow, U+2194 ISOamsa --> +<!ENTITY crarr "↵"> <!-- downwards arrow with corner leftwards + = carriage return, U+21B5 NEW --> +<!ENTITY lArr "⇐"> <!-- leftwards double arrow, U+21D0 ISOtech --> +<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow + but also does not have any other character for that function. So lArr can + be used for 'is implied by' as ISOtech suggests --> +<!ENTITY uArr "⇑"> <!-- upwards double arrow, U+21D1 ISOamsa --> +<!ENTITY rArr "⇒"> <!-- rightwards double arrow, + U+21D2 ISOtech --> +<!-- Unicode does not say this is the 'implies' character but does not have + another character with this function so rArr can be used for 'implies' + as ISOtech suggests --> +<!ENTITY dArr "⇓"> <!-- downwards double arrow, U+21D3 ISOamsa --> +<!ENTITY hArr "⇔"> <!-- left right double arrow, + U+21D4 ISOamsa --> + +<!-- Mathematical Operators --> +<!ENTITY forall "∀"> <!-- for all, U+2200 ISOtech --> +<!ENTITY part "∂"> <!-- partial differential, U+2202 ISOtech --> +<!ENTITY exist "∃"> <!-- there exists, U+2203 ISOtech --> +<!ENTITY empty "∅"> <!-- empty set = null set, U+2205 ISOamso --> +<!ENTITY nabla "∇"> <!-- nabla = backward difference, + U+2207 ISOtech --> +<!ENTITY isin "∈"> <!-- element of, U+2208 ISOtech --> +<!ENTITY notin "∉"> <!-- not an element of, U+2209 ISOtech --> +<!ENTITY ni "∋"> <!-- contains as member, U+220B ISOtech --> +<!ENTITY prod "∏"> <!-- n-ary product = product sign, + U+220F ISOamsb --> +<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though + the same glyph might be used for both --> +<!ENTITY sum "∑"> <!-- n-ary summation, U+2211 ISOamsb --> +<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma' + though the same glyph might be used for both --> +<!ENTITY minus "−"> <!-- minus sign, U+2212 ISOtech --> +<!ENTITY lowast "∗"> <!-- asterisk operator, U+2217 ISOtech --> +<!ENTITY radic "√"> <!-- square root = radical sign, + U+221A ISOtech --> +<!ENTITY prop "∝"> <!-- proportional to, U+221D ISOtech --> +<!ENTITY infin "∞"> <!-- infinity, U+221E ISOtech --> +<!ENTITY ang "∠"> <!-- angle, U+2220 ISOamso --> +<!ENTITY and "∧"> <!-- logical and = wedge, U+2227 ISOtech --> +<!ENTITY or "∨"> <!-- logical or = vee, U+2228 ISOtech --> +<!ENTITY cap "∩"> <!-- intersection = cap, U+2229 ISOtech --> +<!ENTITY cup "∪"> <!-- union = cup, U+222A ISOtech --> +<!ENTITY int "∫"> <!-- integral, U+222B ISOtech --> +<!ENTITY there4 "∴"> <!-- therefore, U+2234 ISOtech --> +<!ENTITY sim "∼"> <!-- tilde operator = varies with = similar to, + U+223C ISOtech --> +<!-- tilde operator is NOT the same character as the tilde, U+007E, + although the same glyph might be used to represent both --> +<!ENTITY cong "≅"> <!-- approximately equal to, U+2245 ISOtech --> +<!ENTITY asymp "≈"> <!-- almost equal to = asymptotic to, + U+2248 ISOamsr --> +<!ENTITY ne "≠"> <!-- not equal to, U+2260 ISOtech --> +<!ENTITY equiv "≡"> <!-- identical to, U+2261 ISOtech --> +<!ENTITY le "≤"> <!-- less-than or equal to, U+2264 ISOtech --> +<!ENTITY ge "≥"> <!-- greater-than or equal to, + U+2265 ISOtech --> +<!ENTITY sub "⊂"> <!-- subset of, U+2282 ISOtech --> +<!ENTITY sup "⊃"> <!-- superset of, U+2283 ISOtech --> +<!ENTITY nsub "⊄"> <!-- not a subset of, U+2284 ISOamsn --> +<!ENTITY sube "⊆"> <!-- subset of or equal to, U+2286 ISOtech --> +<!ENTITY supe "⊇"> <!-- superset of or equal to, + U+2287 ISOtech --> +<!ENTITY oplus "⊕"> <!-- circled plus = direct sum, + U+2295 ISOamsb --> +<!ENTITY otimes "⊗"> <!-- circled times = vector product, + U+2297 ISOamsb --> +<!ENTITY perp "⊥"> <!-- up tack = orthogonal to = perpendicular, + U+22A5 ISOtech --> +<!ENTITY sdot "⋅"> <!-- dot operator, U+22C5 ISOamsb --> +<!-- dot operator is NOT the same character as U+00B7 middle dot --> + +<!-- Miscellaneous Technical --> +<!ENTITY lceil "⌈"> <!-- left ceiling = APL upstile, + U+2308 ISOamsc --> +<!ENTITY rceil "⌉"> <!-- right ceiling, U+2309 ISOamsc --> +<!ENTITY lfloor "⌊"> <!-- left floor = APL downstile, + U+230A ISOamsc --> +<!ENTITY rfloor "⌋"> <!-- right floor, U+230B ISOamsc --> +<!ENTITY lang "〈"> <!-- left-pointing angle bracket = bra, + U+2329 ISOtech --> +<!-- lang is NOT the same character as U+003C 'less than sign' + or U+2039 'single left-pointing angle quotation mark' --> +<!ENTITY rang "〉"> <!-- right-pointing angle bracket = ket, + U+232A ISOtech --> +<!-- rang is NOT the same character as U+003E 'greater than sign' + or U+203A 'single right-pointing angle quotation mark' --> + +<!-- Geometric Shapes --> +<!ENTITY loz "◊"> <!-- lozenge, U+25CA ISOpub --> + +<!-- Miscellaneous Symbols --> +<!ENTITY spades "♠"> <!-- black spade suit, U+2660 ISOpub --> +<!-- black here seems to mean filled as opposed to hollow --> +<!ENTITY clubs "♣"> <!-- black club suit = shamrock, + U+2663 ISOpub --> +<!ENTITY hearts "♥"> <!-- black heart suit = valentine, + U+2665 ISOpub --> +<!ENTITY diams "♦"> <!-- black diamond suit, U+2666 ISOpub --> diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd b/dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd new file mode 100644 index 0000000000..0102078c09 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/xhtml1-frameset.dtd @@ -0,0 +1,1235 @@ +<!-- + Extensible HTML version 1.0 Frameset DTD + + This is the same as HTML 4 Frameset except for + changes due to the differences between XML and SGML. + + Namespace = http://www.w3.org/1999/xhtml + + For further information, see: http://www.w3.org/TR/xhtml1 + + Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), + All Rights Reserved. + + This DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" + SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" + + $Revision: 1.1 $ + $Date: 2007/02/24 01:51:16 $ + +--> + +<!--================ Character mnemonic entities =========================--> + +<!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "xhtml-lat1.ent"> +%HTMLlat1; + +<!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "xhtml-symbol.ent"> +%HTMLsymbol; + +<!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "xhtml-special.ent"> +%HTMLspecial; + +<!--================== Imported Names ====================================--> + +<!ENTITY % ContentType "CDATA"> + <!-- media type, as per [RFC2045] --> + +<!ENTITY % ContentTypes "CDATA"> + <!-- comma-separated list of media types, as per [RFC2045] --> + +<!ENTITY % Charset "CDATA"> + <!-- a character encoding, as per [RFC2045] --> + +<!ENTITY % Charsets "CDATA"> + <!-- a space separated list of character encodings, as per [RFC2045] --> + +<!ENTITY % LanguageCode "NMTOKEN"> + <!-- a language code, as per [RFC3066] --> + +<!ENTITY % Character "CDATA"> + <!-- a single character, as per section 2.2 of [XML] --> + +<!ENTITY % Number "CDATA"> + <!-- one or more digits --> + +<!ENTITY % LinkTypes "CDATA"> + <!-- space-separated list of link types --> + +<!ENTITY % MediaDesc "CDATA"> + <!-- single or comma-separated list of media descriptors --> + +<!ENTITY % URI "CDATA"> + <!-- a Uniform Resource Identifier, see [RFC2396] --> + +<!ENTITY % UriList "CDATA"> + <!-- a space separated list of Uniform Resource Identifiers --> + +<!ENTITY % Datetime "CDATA"> + <!-- date and time information. ISO date format --> + +<!ENTITY % Script "CDATA"> + <!-- script expression --> + +<!ENTITY % StyleSheet "CDATA"> + <!-- style sheet data --> + +<!ENTITY % Text "CDATA"> + <!-- used for titles etc. --> + +<!ENTITY % FrameTarget "NMTOKEN"> + <!-- render in this frame --> + +<!ENTITY % Length "CDATA"> + <!-- nn for pixels or nn% for percentage length --> + +<!ENTITY % MultiLength "CDATA"> + <!-- pixel, percentage, or relative --> + +<!ENTITY % MultiLengths "CDATA"> + <!-- comma-separated list of MultiLength --> + +<!ENTITY % Pixels "CDATA"> + <!-- integer representing length in pixels --> + +<!-- these are used for image maps --> + +<!ENTITY % Shape "(rect|circle|poly|default)"> + +<!ENTITY % Coords "CDATA"> + <!-- comma separated list of lengths --> + +<!-- used for object, applet, img, input and iframe --> +<!ENTITY % ImgAlign "(top|middle|bottom|left|right)"> + +<!-- a color using sRGB: #RRGGBB as Hex values --> +<!ENTITY % Color "CDATA"> + +<!-- There are also 16 widely known color names with their sRGB values: + + Black = #000000 Green = #008000 + Silver = #C0C0C0 Lime = #00FF00 + Gray = #808080 Olive = #808000 + White = #FFFFFF Yellow = #FFFF00 + Maroon = #800000 Navy = #000080 + Red = #FF0000 Blue = #0000FF + Purple = #800080 Teal = #008080 + Fuchsia= #FF00FF Aqua = #00FFFF +--> + +<!--=================== Generic Attributes ===============================--> + +<!-- core attributes common to most elements + id document-wide unique id + class space separated list of classes + style associated style info + title advisory title/amplification +--> +<!ENTITY % coreattrs + "id ID #IMPLIED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED" + > + +<!-- internationalization attributes + lang language code (backwards compatible) + xml:lang language code (as per XML 1.0 spec) + dir direction for weak/neutral text +--> +<!ENTITY % i18n + "lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #IMPLIED" + > + +<!-- attributes for common UI events + onclick a pointer button was clicked + ondblclick a pointer button was double clicked + onmousedown a pointer button was pressed down + onmouseup a pointer button was released + onmousemove a pointer was moved onto the element + onmouseout a pointer was moved away from the element + onkeypress a key was pressed and released + onkeydown a key was pressed down + onkeyup a key was released +--> +<!ENTITY % events + "onclick %Script; #IMPLIED + ondblclick %Script; #IMPLIED + onmousedown %Script; #IMPLIED + onmouseup %Script; #IMPLIED + onmouseover %Script; #IMPLIED + onmousemove %Script; #IMPLIED + onmouseout %Script; #IMPLIED + onkeypress %Script; #IMPLIED + onkeydown %Script; #IMPLIED + onkeyup %Script; #IMPLIED" + > + +<!-- attributes for elements that can get the focus + accesskey accessibility key character + tabindex position in tabbing order + onfocus the element got the focus + onblur the element lost the focus +--> +<!ENTITY % focus + "accesskey %Character; #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED" + > + +<!ENTITY % attrs "%coreattrs; %i18n; %events;"> + +<!-- text alignment for p, div, h1-h6. The default is + align="left" for ltr headings, "right" for rtl --> + +<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED"> + +<!--=================== Text Elements ====================================--> + +<!ENTITY % special.extra + "object | applet | img | map | iframe"> + +<!ENTITY % special.basic + "br | span | bdo"> + +<!ENTITY % special + "%special.basic; | %special.extra;"> + +<!ENTITY % fontstyle.extra "big | small | font | basefont"> + +<!ENTITY % fontstyle.basic "tt | i | b | u + | s | strike "> + +<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;"> + +<!ENTITY % phrase.extra "sub | sup"> +<!ENTITY % phrase.basic "em | strong | dfn | code | q | + samp | kbd | var | cite | abbr | acronym"> + +<!ENTITY % phrase "%phrase.basic; | %phrase.extra;"> + +<!ENTITY % inline.forms "input | select | textarea | label | button"> + +<!-- these can occur at block or inline level --> +<!ENTITY % misc.inline "ins | del | script"> + +<!-- these can only occur at block level --> +<!ENTITY % misc "noscript | %misc.inline;"> + + +<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"> + +<!-- %Inline; covers inline or "text-level" elements --> +<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"> + +<!--================== Block level elements ==============================--> + +<!ENTITY % heading "h1|h2|h3|h4|h5|h6"> +<!ENTITY % lists "ul | ol | dl | menu | dir"> +<!ENTITY % blocktext "pre | hr | blockquote | address | center"> + +<!ENTITY % block + "p | %heading; | div | %lists; | %blocktext; | isindex | fieldset | table"> + +<!-- %Flow; mixes block and inline and is used for list items etc. --> +<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"> + +<!--================== Content models for exclusions =====================--> + +<!-- a elements use %Inline; excluding a --> + +<!ENTITY % a.content + "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"> + +<!-- pre uses %Inline excluding img, object, applet, big, small, + sub, sup, font, or basefont --> + +<!ENTITY % pre.content + "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; | + %inline.forms; | %misc.inline;)*"> + + +<!-- form uses %Flow; excluding form --> + +<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*"> + +<!-- button uses %Flow; but excludes a, form, form controls, iframe --> + +<!ENTITY % button.content + "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | + table | br | span | bdo | object | applet | img | map | + %fontstyle; | %phrase; | %misc;)*"> + +<!--================ Document Structure ==================================--> + +<!-- the namespace URI designates the document profile --> + +<!ELEMENT html (head, frameset)> +<!ATTLIST html + %i18n; + id ID #IMPLIED + xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml' + > + +<!--================ Document Head =======================================--> + +<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*"> + +<!-- content model is %head.misc; combined with a single + title and an optional base element in any order --> + +<!ELEMENT head (%head.misc;, + ((title, %head.misc;, (base, %head.misc;)?) | + (base, %head.misc;, (title, %head.misc;))))> + +<!ATTLIST head + %i18n; + id ID #IMPLIED + profile %URI; #IMPLIED + > + +<!-- The title element is not considered part of the flow of text. + It should be displayed, for example as the page header or + window title. Exactly one title is required per document. + --> +<!ELEMENT title (#PCDATA)> +<!ATTLIST title + %i18n; + id ID #IMPLIED + > + +<!-- document base URI --> + +<!ELEMENT base EMPTY> +<!ATTLIST base + id ID #IMPLIED + href %URI; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- generic metainformation --> +<!ELEMENT meta EMPTY> +<!ATTLIST meta + %i18n; + id ID #IMPLIED + http-equiv CDATA #IMPLIED + name CDATA #IMPLIED + content CDATA #REQUIRED + scheme CDATA #IMPLIED + > + +<!-- + Relationship values can be used in principle: + + a) for document specific toolbars/menus when used + with the link element in document head e.g. + start, contents, previous, next, index, end, help + b) to link to a separate style sheet (rel="stylesheet") + c) to make a link to a script (rel="script") + d) by stylesheets to control how collections of + html nodes are rendered into printed documents + e) to make a link to a printable version of this document + e.g. a PostScript or PDF version (rel="alternate" media="print") +--> + +<!ELEMENT link EMPTY> +<!ATTLIST link + %attrs; + charset %Charset; #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + type %ContentType; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + media %MediaDesc; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- style info, which may include CDATA sections --> +<!ELEMENT style (#PCDATA)> +<!ATTLIST style + %i18n; + id ID #IMPLIED + type %ContentType; #REQUIRED + media %MediaDesc; #IMPLIED + title %Text; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- script statements, which may include CDATA sections --> +<!ELEMENT script (#PCDATA)> +<!ATTLIST script + id ID #IMPLIED + charset %Charset; #IMPLIED + type %ContentType; #REQUIRED + language CDATA #IMPLIED + src %URI; #IMPLIED + defer (defer) #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- alternate content container for non script-based rendering --> + +<!ELEMENT noscript %Flow;> +<!ATTLIST noscript + %attrs; + > + +<!--======================= Frames =======================================--> + +<!-- only one noframes element permitted per document --> + +<!ELEMENT frameset (frameset|frame|noframes)*> +<!ATTLIST frameset + %coreattrs; + rows %MultiLengths; #IMPLIED + cols %MultiLengths; #IMPLIED + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + > + +<!-- reserved frame names start with "_" otherwise starts with letter --> + +<!-- tiled window within frameset --> + +<!ELEMENT frame EMPTY> +<!ATTLIST frame + %coreattrs; + longdesc %URI; #IMPLIED + name NMTOKEN #IMPLIED + src %URI; #IMPLIED + frameborder (1|0) "1" + marginwidth %Pixels; #IMPLIED + marginheight %Pixels; #IMPLIED + noresize (noresize) #IMPLIED + scrolling (yes|no|auto) "auto" + > + +<!-- inline subwindow --> + +<!ELEMENT iframe %Flow;> +<!ATTLIST iframe + %coreattrs; + longdesc %URI; #IMPLIED + name NMTOKEN #IMPLIED + src %URI; #IMPLIED + frameborder (1|0) "1" + marginwidth %Pixels; #IMPLIED + marginheight %Pixels; #IMPLIED + scrolling (yes|no|auto) "auto" + align %ImgAlign; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + > + +<!-- alternate content container for non frame-based rendering --> + +<!ELEMENT noframes (body)> +<!ATTLIST noframes + %attrs; + > + +<!--=================== Document Body ====================================--> + +<!ELEMENT body %Flow;> +<!ATTLIST body + %attrs; + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + background %URI; #IMPLIED + bgcolor %Color; #IMPLIED + text %Color; #IMPLIED + link %Color; #IMPLIED + vlink %Color; #IMPLIED + alink %Color; #IMPLIED + > + +<!ELEMENT div %Flow;> <!-- generic language/style container --> +<!ATTLIST div + %attrs; + %TextAlign; + > + +<!--=================== Paragraphs =======================================--> + +<!ELEMENT p %Inline;> +<!ATTLIST p + %attrs; + %TextAlign; + > + +<!--=================== Headings =========================================--> + +<!-- + There are six levels of headings from h1 (the most important) + to h6 (the least important). +--> + +<!ELEMENT h1 %Inline;> +<!ATTLIST h1 + %attrs; + %TextAlign; + > + +<!ELEMENT h2 %Inline;> +<!ATTLIST h2 + %attrs; + %TextAlign; + > + +<!ELEMENT h3 %Inline;> +<!ATTLIST h3 + %attrs; + %TextAlign; + > + +<!ELEMENT h4 %Inline;> +<!ATTLIST h4 + %attrs; + %TextAlign; + > + +<!ELEMENT h5 %Inline;> +<!ATTLIST h5 + %attrs; + %TextAlign; + > + +<!ELEMENT h6 %Inline;> +<!ATTLIST h6 + %attrs; + %TextAlign; + > + +<!--=================== Lists ============================================--> + +<!-- Unordered list bullet styles --> + +<!ENTITY % ULStyle "(disc|square|circle)"> + +<!-- Unordered list --> + +<!ELEMENT ul (li)+> +<!ATTLIST ul + %attrs; + type %ULStyle; #IMPLIED + compact (compact) #IMPLIED + > + +<!-- Ordered list numbering style + + 1 arabic numbers 1, 2, 3, ... + a lower alpha a, b, c, ... + A upper alpha A, B, C, ... + i lower roman i, ii, iii, ... + I upper roman I, II, III, ... + + The style is applied to the sequence number which by default + is reset to 1 for the first list item in an ordered list. +--> +<!ENTITY % OLStyle "CDATA"> + +<!-- Ordered (numbered) list --> + +<!ELEMENT ol (li)+> +<!ATTLIST ol + %attrs; + type %OLStyle; #IMPLIED + compact (compact) #IMPLIED + start %Number; #IMPLIED + > + +<!-- single column list (DEPRECATED) --> +<!ELEMENT menu (li)+> +<!ATTLIST menu + %attrs; + compact (compact) #IMPLIED + > + +<!-- multiple column list (DEPRECATED) --> +<!ELEMENT dir (li)+> +<!ATTLIST dir + %attrs; + compact (compact) #IMPLIED + > + +<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" --> +<!ENTITY % LIStyle "CDATA"> + +<!-- list item --> + +<!ELEMENT li %Flow;> +<!ATTLIST li + %attrs; + type %LIStyle; #IMPLIED + value %Number; #IMPLIED + > + +<!-- definition lists - dt for term, dd for its definition --> + +<!ELEMENT dl (dt|dd)+> +<!ATTLIST dl + %attrs; + compact (compact) #IMPLIED + > + +<!ELEMENT dt %Inline;> +<!ATTLIST dt + %attrs; + > + +<!ELEMENT dd %Flow;> +<!ATTLIST dd + %attrs; + > + +<!--=================== Address ==========================================--> + +<!-- information on author --> + +<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*> +<!ATTLIST address + %attrs; + > + +<!--=================== Horizontal Rule ==================================--> + +<!ELEMENT hr EMPTY> +<!ATTLIST hr + %attrs; + align (left|center|right) #IMPLIED + noshade (noshade) #IMPLIED + size %Pixels; #IMPLIED + width %Length; #IMPLIED + > + +<!--=================== Preformatted Text ================================--> + +<!-- content is %Inline; excluding + "img|object|applet|big|small|sub|sup|font|basefont" --> + +<!ELEMENT pre %pre.content;> +<!ATTLIST pre + %attrs; + width %Number; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!--=================== Block-like Quotes ================================--> + +<!ELEMENT blockquote %Flow;> +<!ATTLIST blockquote + %attrs; + cite %URI; #IMPLIED + > + +<!--=================== Text alignment ===================================--> + +<!-- center content --> +<!ELEMENT center %Flow;> +<!ATTLIST center + %attrs; + > + +<!--=================== Inserted/Deleted Text ============================--> + + +<!-- + ins/del are allowed in block and inline content, but its + inappropriate to include block content within an ins element + occurring in inline content. +--> +<!ELEMENT ins %Flow;> +<!ATTLIST ins + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!ELEMENT del %Flow;> +<!ATTLIST del + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!--================== The Anchor Element ================================--> + +<!-- content is %Inline; except that anchors shouldn't be nested --> + +<!ELEMENT a %a.content;> +<!ATTLIST a + %attrs; + %focus; + charset %Charset; #IMPLIED + type %ContentType; #IMPLIED + name NMTOKEN #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + shape %Shape; "rect" + coords %Coords; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!--===================== Inline Elements ================================--> + +<!ELEMENT span %Inline;> <!-- generic language/style container --> +<!ATTLIST span + %attrs; + > + +<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride --> +<!ATTLIST bdo + %coreattrs; + %events; + lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #REQUIRED + > + +<!ELEMENT br EMPTY> <!-- forced line break --> +<!ATTLIST br + %coreattrs; + clear (left|all|right|none) "none" + > + +<!ELEMENT em %Inline;> <!-- emphasis --> +<!ATTLIST em %attrs;> + +<!ELEMENT strong %Inline;> <!-- strong emphasis --> +<!ATTLIST strong %attrs;> + +<!ELEMENT dfn %Inline;> <!-- definitional --> +<!ATTLIST dfn %attrs;> + +<!ELEMENT code %Inline;> <!-- program code --> +<!ATTLIST code %attrs;> + +<!ELEMENT samp %Inline;> <!-- sample --> +<!ATTLIST samp %attrs;> + +<!ELEMENT kbd %Inline;> <!-- something user would type --> +<!ATTLIST kbd %attrs;> + +<!ELEMENT var %Inline;> <!-- variable --> +<!ATTLIST var %attrs;> + +<!ELEMENT cite %Inline;> <!-- citation --> +<!ATTLIST cite %attrs;> + +<!ELEMENT abbr %Inline;> <!-- abbreviation --> +<!ATTLIST abbr %attrs;> + +<!ELEMENT acronym %Inline;> <!-- acronym --> +<!ATTLIST acronym %attrs;> + +<!ELEMENT q %Inline;> <!-- inlined quote --> +<!ATTLIST q + %attrs; + cite %URI; #IMPLIED + > + +<!ELEMENT sub %Inline;> <!-- subscript --> +<!ATTLIST sub %attrs;> + +<!ELEMENT sup %Inline;> <!-- superscript --> +<!ATTLIST sup %attrs;> + +<!ELEMENT tt %Inline;> <!-- fixed pitch font --> +<!ATTLIST tt %attrs;> + +<!ELEMENT i %Inline;> <!-- italic font --> +<!ATTLIST i %attrs;> + +<!ELEMENT b %Inline;> <!-- bold font --> +<!ATTLIST b %attrs;> + +<!ELEMENT big %Inline;> <!-- bigger font --> +<!ATTLIST big %attrs;> + +<!ELEMENT small %Inline;> <!-- smaller font --> +<!ATTLIST small %attrs;> + +<!ELEMENT u %Inline;> <!-- underline --> +<!ATTLIST u %attrs;> + +<!ELEMENT s %Inline;> <!-- strike-through --> +<!ATTLIST s %attrs;> + +<!ELEMENT strike %Inline;> <!-- strike-through --> +<!ATTLIST strike %attrs;> + +<!ELEMENT basefont EMPTY> <!-- base font size --> +<!ATTLIST basefont + id ID #IMPLIED + size CDATA #REQUIRED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!ELEMENT font %Inline;> <!-- local change to font --> +<!ATTLIST font + %coreattrs; + %i18n; + size CDATA #IMPLIED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!--==================== Object ======================================--> +<!-- + object is used to embed objects as part of HTML pages. + param elements should precede other content. Parameters + can also be expressed as attribute/value pairs on the + object element itself when brevity is desired. +--> + +<!ELEMENT object (#PCDATA | param | %block; | form |%inline; | %misc;)*> +<!ATTLIST object + %attrs; + declare (declare) #IMPLIED + classid %URI; #IMPLIED + codebase %URI; #IMPLIED + data %URI; #IMPLIED + type %ContentType; #IMPLIED + codetype %ContentType; #IMPLIED + archive %UriList; #IMPLIED + standby %Text; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + name NMTOKEN #IMPLIED + tabindex %Number; #IMPLIED + align %ImgAlign; #IMPLIED + border %Pixels; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- + param is used to supply a named property value. + In XML it would seem natural to follow RDF and support an + abbreviated syntax where the param elements are replaced + by attribute value pairs on the object start tag. +--> +<!ELEMENT param EMPTY> +<!ATTLIST param + id ID #IMPLIED + name CDATA #REQUIRED + value CDATA #IMPLIED + valuetype (data|ref|object) "data" + type %ContentType; #IMPLIED + > + +<!--=================== Java applet ==================================--> +<!-- + One of code or object attributes must be present. + Place param elements before other content. +--> +<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST applet + %coreattrs; + codebase %URI; #IMPLIED + archive CDATA #IMPLIED + code CDATA #IMPLIED + object CDATA #IMPLIED + alt %Text; #IMPLIED + name NMTOKEN #IMPLIED + width %Length; #REQUIRED + height %Length; #REQUIRED + align %ImgAlign; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!--=================== Images ===========================================--> + +<!-- + To avoid accessibility problems for people who aren't + able to see the image, you should provide a text + description using the alt and longdesc attributes. + In addition, avoid the use of server-side image maps. +--> + +<!ELEMENT img EMPTY> +<!ATTLIST img + %attrs; + src %URI; #REQUIRED + alt %Text; #REQUIRED + name NMTOKEN #IMPLIED + longdesc %URI; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + ismap (ismap) #IMPLIED + align %ImgAlign; #IMPLIED + border %Pixels; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- usemap points to a map element which may be in this document + or an external document, although the latter is not widely supported --> + +<!--================== Client-side image maps ============================--> + +<!-- These can be placed in the same document or grouped in a + separate document although this isn't yet widely supported --> + +<!ELEMENT map ((%block; | form | %misc;)+ | area+)> +<!ATTLIST map + %i18n; + %events; + id ID #REQUIRED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED + name NMTOKEN #IMPLIED + > + +<!ELEMENT area EMPTY> +<!ATTLIST area + %attrs; + %focus; + shape %Shape; "rect" + coords %Coords; #IMPLIED + href %URI; #IMPLIED + nohref (nohref) #IMPLIED + alt %Text; #REQUIRED + target %FrameTarget; #IMPLIED + > + +<!--================ Forms ===============================================--> + +<!ELEMENT form %form.content;> <!-- forms shouldn't be nested --> + +<!ATTLIST form + %attrs; + action %URI; #REQUIRED + method (get|post) "get" + name NMTOKEN #IMPLIED + enctype %ContentType; "application/x-www-form-urlencoded" + onsubmit %Script; #IMPLIED + onreset %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + accept-charset %Charsets; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- + Each label must not contain more than ONE field + Label elements shouldn't be nested. +--> +<!ELEMENT label %Inline;> +<!ATTLIST label + %attrs; + for IDREF #IMPLIED + accesskey %Character; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + > + +<!ENTITY % InputType + "(text | password | checkbox | + radio | submit | reset | + file | hidden | image | button)" + > + +<!-- the name attribute is required for all but submit & reset --> + +<!ELEMENT input EMPTY> <!-- form control --> +<!ATTLIST input + %attrs; + %focus; + type %InputType; "text" + name CDATA #IMPLIED + value CDATA #IMPLIED + checked (checked) #IMPLIED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + size CDATA #IMPLIED + maxlength %Number; #IMPLIED + src %URI; #IMPLIED + alt CDATA #IMPLIED + usemap %URI; #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + align %ImgAlign; #IMPLIED + > + +<!ELEMENT select (optgroup|option)+> <!-- option selector --> +<!ATTLIST select + %attrs; + name CDATA #IMPLIED + size %Number; #IMPLIED + multiple (multiple) #IMPLIED + disabled (disabled) #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!ELEMENT optgroup (option)+> <!-- option group --> +<!ATTLIST optgroup + %attrs; + disabled (disabled) #IMPLIED + label %Text; #REQUIRED + > + +<!ELEMENT option (#PCDATA)> <!-- selectable choice --> +<!ATTLIST option + %attrs; + selected (selected) #IMPLIED + disabled (disabled) #IMPLIED + label %Text; #IMPLIED + value CDATA #IMPLIED + > + +<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field --> +<!ATTLIST textarea + %attrs; + %focus; + name CDATA #IMPLIED + rows %Number; #REQUIRED + cols %Number; #REQUIRED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!-- + The fieldset element is used to group form fields. + Only one legend element should occur in the content + and if present should only be preceded by whitespace. +--> +<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*> +<!ATTLIST fieldset + %attrs; + > + +<!ENTITY % LAlign "(top|bottom|left|right)"> + +<!ELEMENT legend %Inline;> <!-- fieldset label --> +<!ATTLIST legend + %attrs; + accesskey %Character; #IMPLIED + align %LAlign; #IMPLIED + > + +<!-- + Content is %Flow; excluding a, form, form controls, iframe +--> +<!ELEMENT button %button.content;> <!-- push button --> +<!ATTLIST button + %attrs; + %focus; + name CDATA #IMPLIED + value CDATA #IMPLIED + type (button|submit|reset) "submit" + disabled (disabled) #IMPLIED + > + +<!-- single-line text input control (DEPRECATED) --> +<!ELEMENT isindex EMPTY> +<!ATTLIST isindex + %coreattrs; + %i18n; + prompt %Text; #IMPLIED + > + +<!--======================= Tables =======================================--> + +<!-- Derived from IETF HTML table standard, see [RFC1942] --> + +<!-- + The border attribute sets the thickness of the frame around the + table. The default units are screen pixels. + + The frame attribute specifies which parts of the frame around + the table should be rendered. The values are not the same as + CALS to avoid a name clash with the valign attribute. +--> +<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> + +<!-- + The rules attribute defines which rules to draw between cells: + + If rules is absent then assume: + "none" if border is absent or border="0" otherwise "all" +--> + +<!ENTITY % TRules "(none | groups | rows | cols | all)"> + +<!-- horizontal placement of table relative to document --> +<!ENTITY % TAlign "(left|center|right)"> + +<!-- horizontal alignment attributes for cell contents + + char alignment char, e.g. char=":" + charoff offset for alignment char +--> +<!ENTITY % cellhalign + "align (left|center|right|justify|char) #IMPLIED + char %Character; #IMPLIED + charoff %Length; #IMPLIED" + > + +<!-- vertical alignment attributes for cell contents --> +<!ENTITY % cellvalign + "valign (top|middle|bottom|baseline) #IMPLIED" + > + +<!ELEMENT table + (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> +<!ELEMENT caption %Inline;> +<!ELEMENT thead (tr)+> +<!ELEMENT tfoot (tr)+> +<!ELEMENT tbody (tr)+> +<!ELEMENT colgroup (col)*> +<!ELEMENT col EMPTY> +<!ELEMENT tr (th|td)+> +<!ELEMENT th %Flow;> +<!ELEMENT td %Flow;> + +<!ATTLIST table + %attrs; + summary %Text; #IMPLIED + width %Length; #IMPLIED + border %Pixels; #IMPLIED + frame %TFrame; #IMPLIED + rules %TRules; #IMPLIED + cellspacing %Length; #IMPLIED + cellpadding %Length; #IMPLIED + align %TAlign; #IMPLIED + bgcolor %Color; #IMPLIED + > + +<!ENTITY % CAlign "(top|bottom|left|right)"> + +<!ATTLIST caption + %attrs; + align %CAlign; #IMPLIED + > + +<!-- +colgroup groups a set of col elements. It allows you to group +several semantically related columns together. +--> +<!ATTLIST colgroup + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + col elements define the alignment properties for cells in + one or more columns. + + The width attribute specifies the width of the columns, e.g. + + width=64 width in screen pixels + width=0.5* relative width of 0.5 + + The span attribute causes the attributes of one + col element to apply to more than one column. +--> +<!ATTLIST col + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + Use thead to duplicate headers when breaking table + across page boundaries, or for static headers when + tbody sections are rendered in scrolling panel. + + Use tfoot to duplicate footers when breaking table + across page boundaries, or for static footers when + tbody sections are rendered in scrolling panel. + + Use multiple tbody sections when rules are needed + between groups of table rows. +--> +<!ATTLIST thead + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tfoot + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tbody + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tr + %attrs; + %cellhalign; + %cellvalign; + bgcolor %Color; #IMPLIED + > + +<!-- Scope is simpler than headers attribute for common tables --> +<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> + +<!-- th is for headers, td for data and for cells acting as both --> + +<!ATTLIST th + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Pixels; #IMPLIED + height %Pixels; #IMPLIED + > + +<!ATTLIST td + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Pixels; #IMPLIED + height %Pixels; #IMPLIED + > + diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd b/dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd new file mode 100644 index 0000000000..f3d0fba350 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/xhtml1-strict.dtd @@ -0,0 +1,65 @@ +<!--
+
+Copyright (c) 2001-2004 World Wide Web Consortium,
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University). All
+Rights Reserved. This program is distributed under the W3C's Software
+Intellectual Property License. This program is distributed 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.
+
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+
+-->
+
+<!--
+
+This is a radically simplified DTD for use in the DOM Test Suites
+due to a XML non-conformance of one implementation in processing
+parameter entities. When that non-conformance is resolved,
+this DTD can be replaced by the normal DTD for XHTML.
+
+-->
+
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html xmlns CDATA #IMPLIED>
+<!ELEMENT head (meta,title,script*)>
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ http-equiv CDATA #IMPLIED
+ content CDATA #IMPLIED>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT body (p*)>
+<!ATTLIST body onload CDATA #IMPLIED>
+<!ELEMENT p (#PCDATA|em|strong|code|sup|var|acronym|abbr)*>
+<!ATTLIST p
+ xmlns:dmstc CDATA #IMPLIED
+ xmlns:nm CDATA #IMPLIED
+ xmlns:emp2 CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT em (#PCDATA)>
+<!ELEMENT span (#PCDATA)>
+<!ELEMENT strong (#PCDATA)>
+<!ELEMENT code (#PCDATA)>
+<!ELEMENT sup (#PCDATA)>
+<!ELEMENT var (#PCDATA|span)*>
+<!ELEMENT acronym (#PCDATA)>
+<!ATTLIST acronym
+ title CDATA #IMPLIED
+ class CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT abbr (#PCDATA)>
+<!ATTLIST abbr
+ title CDATA #IMPLIED
+ class CDATA #IMPLIED
+ id ID #IMPLIED
+>
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ type CDATA #IMPLIED
+ src CDATA #IMPLIED
+ charset CDATA #IMPLIED>
diff --git a/dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd b/dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd new file mode 100644 index 0000000000..f8073c836b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/files/xhtml1-transitional.dtd @@ -0,0 +1,1201 @@ +<!-- + Extensible HTML version 1.0 Transitional DTD + + This is the same as HTML 4 Transitional except for + changes due to the differences between XML and SGML. + + Namespace = http://www.w3.org/1999/xhtml + + For further information, see: http://www.w3.org/TR/xhtml1 + + Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), + All Rights Reserved. + + This DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + + $Revision: 1.1 $ + $Date: 2007/02/24 01:51:16 $ + +--> + +<!--================ Character mnemonic entities =========================--> + +<!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "xhtml-lat1.ent"> +%HTMLlat1; + +<!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "xhtml-symbol.ent"> +%HTMLsymbol; + +<!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "xhtml-special.ent"> +%HTMLspecial; + +<!--================== Imported Names ====================================--> + +<!ENTITY % ContentType "CDATA"> + <!-- media type, as per [RFC2045] --> + +<!ENTITY % ContentTypes "CDATA"> + <!-- comma-separated list of media types, as per [RFC2045] --> + +<!ENTITY % Charset "CDATA"> + <!-- a character encoding, as per [RFC2045] --> + +<!ENTITY % Charsets "CDATA"> + <!-- a space separated list of character encodings, as per [RFC2045] --> + +<!ENTITY % LanguageCode "NMTOKEN"> + <!-- a language code, as per [RFC3066] --> + +<!ENTITY % Character "CDATA"> + <!-- a single character, as per section 2.2 of [XML] --> + +<!ENTITY % Number "CDATA"> + <!-- one or more digits --> + +<!ENTITY % LinkTypes "CDATA"> + <!-- space-separated list of link types --> + +<!ENTITY % MediaDesc "CDATA"> + <!-- single or comma-separated list of media descriptors --> + +<!ENTITY % URI "CDATA"> + <!-- a Uniform Resource Identifier, see [RFC2396] --> + +<!ENTITY % UriList "CDATA"> + <!-- a space separated list of Uniform Resource Identifiers --> + +<!ENTITY % Datetime "CDATA"> + <!-- date and time information. ISO date format --> + +<!ENTITY % Script "CDATA"> + <!-- script expression --> + +<!ENTITY % StyleSheet "CDATA"> + <!-- style sheet data --> + +<!ENTITY % Text "CDATA"> + <!-- used for titles etc. --> + +<!ENTITY % FrameTarget "NMTOKEN"> + <!-- render in this frame --> + +<!ENTITY % Length "CDATA"> + <!-- nn for pixels or nn% for percentage length --> + +<!ENTITY % MultiLength "CDATA"> + <!-- pixel, percentage, or relative --> + +<!ENTITY % Pixels "CDATA"> + <!-- integer representing length in pixels --> + +<!-- these are used for image maps --> + +<!ENTITY % Shape "(rect|circle|poly|default)"> + +<!ENTITY % Coords "CDATA"> + <!-- comma separated list of lengths --> + +<!-- used for object, applet, img, input and iframe --> +<!ENTITY % ImgAlign "(top|middle|bottom|left|right)"> + +<!-- a color using sRGB: #RRGGBB as Hex values --> +<!ENTITY % Color "CDATA"> + +<!-- There are also 16 widely known color names with their sRGB values: + + Black = #000000 Green = #008000 + Silver = #C0C0C0 Lime = #00FF00 + Gray = #808080 Olive = #808000 + White = #FFFFFF Yellow = #FFFF00 + Maroon = #800000 Navy = #000080 + Red = #FF0000 Blue = #0000FF + Purple = #800080 Teal = #008080 + Fuchsia= #FF00FF Aqua = #00FFFF +--> + +<!--=================== Generic Attributes ===============================--> + +<!-- core attributes common to most elements + id document-wide unique id + class space separated list of classes + style associated style info + title advisory title/amplification +--> +<!ENTITY % coreattrs + "id ID #IMPLIED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED" + > + +<!-- internationalization attributes + lang language code (backwards compatible) + xml:lang language code (as per XML 1.0 spec) + dir direction for weak/neutral text +--> +<!ENTITY % i18n + "lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #IMPLIED" + > + +<!-- attributes for common UI events + onclick a pointer button was clicked + ondblclick a pointer button was double clicked + onmousedown a pointer button was pressed down + onmouseup a pointer button was released + onmousemove a pointer was moved onto the element + onmouseout a pointer was moved away from the element + onkeypress a key was pressed and released + onkeydown a key was pressed down + onkeyup a key was released +--> +<!ENTITY % events + "onclick %Script; #IMPLIED + ondblclick %Script; #IMPLIED + onmousedown %Script; #IMPLIED + onmouseup %Script; #IMPLIED + onmouseover %Script; #IMPLIED + onmousemove %Script; #IMPLIED + onmouseout %Script; #IMPLIED + onkeypress %Script; #IMPLIED + onkeydown %Script; #IMPLIED + onkeyup %Script; #IMPLIED" + > + +<!-- attributes for elements that can get the focus + accesskey accessibility key character + tabindex position in tabbing order + onfocus the element got the focus + onblur the element lost the focus +--> +<!ENTITY % focus + "accesskey %Character; #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED" + > + +<!ENTITY % attrs "%coreattrs; %i18n; %events;"> + +<!-- text alignment for p, div, h1-h6. The default is + align="left" for ltr headings, "right" for rtl --> + +<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED"> + +<!--=================== Text Elements ====================================--> + +<!ENTITY % special.extra + "object | applet | img | map | iframe"> + +<!ENTITY % special.basic + "br | span | bdo"> + +<!ENTITY % special + "%special.basic; | %special.extra;"> + +<!ENTITY % fontstyle.extra "big | small | font | basefont"> + +<!ENTITY % fontstyle.basic "tt | i | b | u + | s | strike "> + +<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;"> + +<!ENTITY % phrase.extra "sub | sup"> +<!ENTITY % phrase.basic "em | strong | dfn | code | q | + samp | kbd | var | cite | abbr | acronym"> + +<!ENTITY % phrase "%phrase.basic; | %phrase.extra;"> + +<!ENTITY % inline.forms "input | select | textarea | label | button"> + +<!-- these can occur at block or inline level --> +<!ENTITY % misc.inline "ins | del | script"> + +<!-- these can only occur at block level --> +<!ENTITY % misc "noscript | %misc.inline;"> + +<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"> + +<!-- %Inline; covers inline or "text-level" elements --> +<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"> + +<!--================== Block level elements ==============================--> + +<!ENTITY % heading "h1|h2|h3|h4|h5|h6"> +<!ENTITY % lists "ul | ol | dl | menu | dir"> +<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes"> + +<!ENTITY % block + "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table"> + +<!-- %Flow; mixes block and inline and is used for list items etc. --> +<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"> + +<!--================== Content models for exclusions =====================--> + +<!-- a elements use %Inline; excluding a --> + +<!ENTITY % a.content + "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"> + +<!-- pre uses %Inline excluding img, object, applet, big, small, + font, or basefont --> + +<!ENTITY % pre.content + "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; | + %inline.forms; | %misc.inline;)*"> + +<!-- form uses %Flow; excluding form --> + +<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*"> + +<!-- button uses %Flow; but excludes a, form, form controls, iframe --> + +<!ENTITY % button.content + "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | + table | br | span | bdo | object | applet | img | map | + %fontstyle; | %phrase; | %misc;)*"> + +<!--================ Document Structure ==================================--> + +<!-- the namespace URI designates the document profile --> + +<!ELEMENT html (head, body)> +<!ATTLIST html + %i18n; + id ID #IMPLIED + xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml' + > + +<!--================ Document Head =======================================--> + +<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*"> + +<!-- content model is %head.misc; combined with a single + title and an optional base element in any order --> + +<!ELEMENT head (%head.misc;, + ((title, %head.misc;, (base, %head.misc;)?) | + (base, %head.misc;, (title, %head.misc;))))> + +<!ATTLIST head + %i18n; + id ID #IMPLIED + profile %URI; #IMPLIED + > + +<!-- The title element is not considered part of the flow of text. + It should be displayed, for example as the page header or + window title. Exactly one title is required per document. + --> +<!ELEMENT title (#PCDATA)> +<!ATTLIST title + %i18n; + id ID #IMPLIED + > + +<!-- document base URI --> + +<!ELEMENT base EMPTY> +<!ATTLIST base + id ID #IMPLIED + href %URI; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- generic metainformation --> +<!ELEMENT meta EMPTY> +<!ATTLIST meta + %i18n; + id ID #IMPLIED + http-equiv CDATA #IMPLIED + name CDATA #IMPLIED + content CDATA #REQUIRED + scheme CDATA #IMPLIED + > + +<!-- + Relationship values can be used in principle: + + a) for document specific toolbars/menus when used + with the link element in document head e.g. + start, contents, previous, next, index, end, help + b) to link to a separate style sheet (rel="stylesheet") + c) to make a link to a script (rel="script") + d) by stylesheets to control how collections of + html nodes are rendered into printed documents + e) to make a link to a printable version of this document + e.g. a PostScript or PDF version (rel="alternate" media="print") +--> + +<!ELEMENT link EMPTY> +<!ATTLIST link + %attrs; + charset %Charset; #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + type %ContentType; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + media %MediaDesc; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- style info, which may include CDATA sections --> +<!ELEMENT style (#PCDATA)> +<!ATTLIST style + %i18n; + id ID #IMPLIED + type %ContentType; #REQUIRED + media %MediaDesc; #IMPLIED + title %Text; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- script statements, which may include CDATA sections --> +<!ELEMENT script (#PCDATA)> +<!ATTLIST script + id ID #IMPLIED + charset %Charset; #IMPLIED + type %ContentType; #REQUIRED + language CDATA #IMPLIED + src %URI; #IMPLIED + defer (defer) #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- alternate content container for non script-based rendering --> + +<!ELEMENT noscript %Flow;> +<!ATTLIST noscript + %attrs; + > + +<!--======================= Frames =======================================--> + +<!-- inline subwindow --> + +<!ELEMENT iframe %Flow;> +<!ATTLIST iframe + %coreattrs; + longdesc %URI; #IMPLIED + name NMTOKEN #IMPLIED + src %URI; #IMPLIED + frameborder (1|0) "1" + marginwidth %Pixels; #IMPLIED + marginheight %Pixels; #IMPLIED + scrolling (yes|no|auto) "auto" + align %ImgAlign; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + > + +<!-- alternate content container for non frame-based rendering --> + +<!ELEMENT noframes %Flow;> +<!ATTLIST noframes + %attrs; + > + +<!--=================== Document Body ====================================--> + +<!ELEMENT body %Flow;> +<!ATTLIST body + %attrs; + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + background %URI; #IMPLIED + bgcolor %Color; #IMPLIED + text %Color; #IMPLIED + link %Color; #IMPLIED + vlink %Color; #IMPLIED + alink %Color; #IMPLIED + > + +<!ELEMENT div %Flow;> <!-- generic language/style container --> +<!ATTLIST div + %attrs; + %TextAlign; + > + +<!--=================== Paragraphs =======================================--> + +<!ELEMENT p %Inline;> +<!ATTLIST p + %attrs; + %TextAlign; + > + +<!--=================== Headings =========================================--> + +<!-- + There are six levels of headings from h1 (the most important) + to h6 (the least important). +--> + +<!ELEMENT h1 %Inline;> +<!ATTLIST h1 + %attrs; + %TextAlign; + > + +<!ELEMENT h2 %Inline;> +<!ATTLIST h2 + %attrs; + %TextAlign; + > + +<!ELEMENT h3 %Inline;> +<!ATTLIST h3 + %attrs; + %TextAlign; + > + +<!ELEMENT h4 %Inline;> +<!ATTLIST h4 + %attrs; + %TextAlign; + > + +<!ELEMENT h5 %Inline;> +<!ATTLIST h5 + %attrs; + %TextAlign; + > + +<!ELEMENT h6 %Inline;> +<!ATTLIST h6 + %attrs; + %TextAlign; + > + +<!--=================== Lists ============================================--> + +<!-- Unordered list bullet styles --> + +<!ENTITY % ULStyle "(disc|square|circle)"> + +<!-- Unordered list --> + +<!ELEMENT ul (li)+> +<!ATTLIST ul + %attrs; + type %ULStyle; #IMPLIED + compact (compact) #IMPLIED + > + +<!-- Ordered list numbering style + + 1 arabic numbers 1, 2, 3, ... + a lower alpha a, b, c, ... + A upper alpha A, B, C, ... + i lower roman i, ii, iii, ... + I upper roman I, II, III, ... + + The style is applied to the sequence number which by default + is reset to 1 for the first list item in an ordered list. +--> +<!ENTITY % OLStyle "CDATA"> + +<!-- Ordered (numbered) list --> + +<!ELEMENT ol (li)+> +<!ATTLIST ol + %attrs; + type %OLStyle; #IMPLIED + compact (compact) #IMPLIED + start %Number; #IMPLIED + > + +<!-- single column list (DEPRECATED) --> +<!ELEMENT menu (li)+> +<!ATTLIST menu + %attrs; + compact (compact) #IMPLIED + > + +<!-- multiple column list (DEPRECATED) --> +<!ELEMENT dir (li)+> +<!ATTLIST dir + %attrs; + compact (compact) #IMPLIED + > + +<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" --> +<!ENTITY % LIStyle "CDATA"> + +<!-- list item --> + +<!ELEMENT li %Flow;> +<!ATTLIST li + %attrs; + type %LIStyle; #IMPLIED + value %Number; #IMPLIED + > + +<!-- definition lists - dt for term, dd for its definition --> + +<!ELEMENT dl (dt|dd)+> +<!ATTLIST dl + %attrs; + compact (compact) #IMPLIED + > + +<!ELEMENT dt %Inline;> +<!ATTLIST dt + %attrs; + > + +<!ELEMENT dd %Flow;> +<!ATTLIST dd + %attrs; + > + +<!--=================== Address ==========================================--> + +<!-- information on author --> + +<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*> +<!ATTLIST address + %attrs; + > + +<!--=================== Horizontal Rule ==================================--> + +<!ELEMENT hr EMPTY> +<!ATTLIST hr + %attrs; + align (left|center|right) #IMPLIED + noshade (noshade) #IMPLIED + size %Pixels; #IMPLIED + width %Length; #IMPLIED + > + +<!--=================== Preformatted Text ================================--> + +<!-- content is %Inline; excluding + "img|object|applet|big|small|sub|sup|font|basefont" --> + +<!ELEMENT pre %pre.content;> +<!ATTLIST pre + %attrs; + width %Number; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!--=================== Block-like Quotes ================================--> + +<!ELEMENT blockquote %Flow;> +<!ATTLIST blockquote + %attrs; + cite %URI; #IMPLIED + > + +<!--=================== Text alignment ===================================--> + +<!-- center content --> +<!ELEMENT center %Flow;> +<!ATTLIST center + %attrs; + > + +<!--=================== Inserted/Deleted Text ============================--> + +<!-- + ins/del are allowed in block and inline content, but its + inappropriate to include block content within an ins element + occurring in inline content. +--> +<!ELEMENT ins %Flow;> +<!ATTLIST ins + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!ELEMENT del %Flow;> +<!ATTLIST del + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!--================== The Anchor Element ================================--> + +<!-- content is %Inline; except that anchors shouldn't be nested --> + +<!ELEMENT a %a.content;> +<!ATTLIST a + %attrs; + %focus; + charset %Charset; #IMPLIED + type %ContentType; #IMPLIED + name NMTOKEN #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + shape %Shape; "rect" + coords %Coords; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!--===================== Inline Elements ================================--> + +<!ELEMENT span %Inline;> <!-- generic language/style container --> +<!ATTLIST span + %attrs; + > + +<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride --> +<!ATTLIST bdo + %coreattrs; + %events; + lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #REQUIRED + > + +<!ELEMENT br EMPTY> <!-- forced line break --> +<!ATTLIST br + %coreattrs; + clear (left|all|right|none) "none" + > + +<!ELEMENT em %Inline;> <!-- emphasis --> +<!ATTLIST em %attrs;> + +<!ELEMENT strong %Inline;> <!-- strong emphasis --> +<!ATTLIST strong %attrs;> + +<!ELEMENT dfn %Inline;> <!-- definitional --> +<!ATTLIST dfn %attrs;> + +<!ELEMENT code %Inline;> <!-- program code --> +<!ATTLIST code %attrs;> + +<!ELEMENT samp %Inline;> <!-- sample --> +<!ATTLIST samp %attrs;> + +<!ELEMENT kbd %Inline;> <!-- something user would type --> +<!ATTLIST kbd %attrs;> + +<!ELEMENT var %Inline;> <!-- variable --> +<!ATTLIST var %attrs;> + +<!ELEMENT cite %Inline;> <!-- citation --> +<!ATTLIST cite %attrs;> + +<!ELEMENT abbr %Inline;> <!-- abbreviation --> +<!ATTLIST abbr %attrs;> + +<!ELEMENT acronym %Inline;> <!-- acronym --> +<!ATTLIST acronym %attrs;> + +<!ELEMENT q %Inline;> <!-- inlined quote --> +<!ATTLIST q + %attrs; + cite %URI; #IMPLIED + > + +<!ELEMENT sub %Inline;> <!-- subscript --> +<!ATTLIST sub %attrs;> + +<!ELEMENT sup %Inline;> <!-- superscript --> +<!ATTLIST sup %attrs;> + +<!ELEMENT tt %Inline;> <!-- fixed pitch font --> +<!ATTLIST tt %attrs;> + +<!ELEMENT i %Inline;> <!-- italic font --> +<!ATTLIST i %attrs;> + +<!ELEMENT b %Inline;> <!-- bold font --> +<!ATTLIST b %attrs;> + +<!ELEMENT big %Inline;> <!-- bigger font --> +<!ATTLIST big %attrs;> + +<!ELEMENT small %Inline;> <!-- smaller font --> +<!ATTLIST small %attrs;> + +<!ELEMENT u %Inline;> <!-- underline --> +<!ATTLIST u %attrs;> + +<!ELEMENT s %Inline;> <!-- strike-through --> +<!ATTLIST s %attrs;> + +<!ELEMENT strike %Inline;> <!-- strike-through --> +<!ATTLIST strike %attrs;> + +<!ELEMENT basefont EMPTY> <!-- base font size --> +<!ATTLIST basefont + id ID #IMPLIED + size CDATA #REQUIRED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!ELEMENT font %Inline;> <!-- local change to font --> +<!ATTLIST font + %coreattrs; + %i18n; + size CDATA #IMPLIED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!--==================== Object ======================================--> +<!-- + object is used to embed objects as part of HTML pages. + param elements should precede other content. Parameters + can also be expressed as attribute/value pairs on the + object element itself when brevity is desired. +--> + +<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST object + %attrs; + declare (declare) #IMPLIED + classid %URI; #IMPLIED + codebase %URI; #IMPLIED + data %URI; #IMPLIED + type %ContentType; #IMPLIED + codetype %ContentType; #IMPLIED + archive %UriList; #IMPLIED + standby %Text; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + name NMTOKEN #IMPLIED + tabindex %Number; #IMPLIED + align %ImgAlign; #IMPLIED + border %Pixels; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- + param is used to supply a named property value. + In XML it would seem natural to follow RDF and support an + abbreviated syntax where the param elements are replaced + by attribute value pairs on the object start tag. +--> +<!ELEMENT param EMPTY> +<!ATTLIST param + id ID #IMPLIED + name CDATA #REQUIRED + value CDATA #IMPLIED + valuetype (data|ref|object) "data" + type %ContentType; #IMPLIED + > + +<!--=================== Java applet ==================================--> +<!-- + One of code or object attributes must be present. + Place param elements before other content. +--> +<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST applet + %coreattrs; + codebase %URI; #IMPLIED + archive CDATA #IMPLIED + code CDATA #IMPLIED + object CDATA #IMPLIED + alt %Text; #IMPLIED + name NMTOKEN #IMPLIED + width %Length; #REQUIRED + height %Length; #REQUIRED + align %ImgAlign; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!--=================== Images ===========================================--> + +<!-- + To avoid accessibility problems for people who aren't + able to see the image, you should provide a text + description using the alt and longdesc attributes. + In addition, avoid the use of server-side image maps. +--> + +<!ELEMENT img EMPTY> +<!ATTLIST img + %attrs; + src %URI; #REQUIRED + alt %Text; #REQUIRED + name NMTOKEN #IMPLIED + longdesc %URI; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + ismap (ismap) #IMPLIED + align %ImgAlign; #IMPLIED + border %Length; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- usemap points to a map element which may be in this document + or an external document, although the latter is not widely supported --> + +<!--================== Client-side image maps ============================--> + +<!-- These can be placed in the same document or grouped in a + separate document although this isn't yet widely supported --> + +<!ELEMENT map ((%block; | form | %misc;)+ | area+)> +<!ATTLIST map + %i18n; + %events; + id ID #REQUIRED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED + name CDATA #IMPLIED + > + +<!ELEMENT area EMPTY> +<!ATTLIST area + %attrs; + %focus; + shape %Shape; "rect" + coords %Coords; #IMPLIED + href %URI; #IMPLIED + nohref (nohref) #IMPLIED + alt %Text; #REQUIRED + target %FrameTarget; #IMPLIED + > + +<!--================ Forms ===============================================--> + +<!ELEMENT form %form.content;> <!-- forms shouldn't be nested --> + +<!ATTLIST form + %attrs; + action %URI; #REQUIRED + method (get|post) "get" + name NMTOKEN #IMPLIED + enctype %ContentType; "application/x-www-form-urlencoded" + onsubmit %Script; #IMPLIED + onreset %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + accept-charset %Charsets; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- + Each label must not contain more than ONE field + Label elements shouldn't be nested. +--> +<!ELEMENT label %Inline;> +<!ATTLIST label + %attrs; + for IDREF #IMPLIED + accesskey %Character; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + > + +<!ENTITY % InputType + "(text | password | checkbox | + radio | submit | reset | + file | hidden | image | button)" + > + +<!-- the name attribute is required for all but submit & reset --> + +<!ELEMENT input EMPTY> <!-- form control --> +<!ATTLIST input + %attrs; + %focus; + type %InputType; "text" + name CDATA #IMPLIED + value CDATA #IMPLIED + checked (checked) #IMPLIED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + size CDATA #IMPLIED + maxlength %Number; #IMPLIED + src %URI; #IMPLIED + alt CDATA #IMPLIED + usemap %URI; #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + align %ImgAlign; #IMPLIED + > + +<!ELEMENT select (optgroup|option)+> <!-- option selector --> +<!ATTLIST select + %attrs; + name CDATA #IMPLIED + size %Number; #IMPLIED + multiple (multiple) #IMPLIED + disabled (disabled) #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!ELEMENT optgroup (option)+> <!-- option group --> +<!ATTLIST optgroup + %attrs; + disabled (disabled) #IMPLIED + label %Text; #REQUIRED + > + +<!ELEMENT option (#PCDATA)> <!-- selectable choice --> +<!ATTLIST option + %attrs; + selected (selected) #IMPLIED + disabled (disabled) #IMPLIED + label %Text; #IMPLIED + value CDATA #IMPLIED + > + +<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field --> +<!ATTLIST textarea + %attrs; + %focus; + name CDATA #IMPLIED + rows %Number; #REQUIRED + cols %Number; #REQUIRED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!-- + The fieldset element is used to group form fields. + Only one legend element should occur in the content + and if present should only be preceded by whitespace. +--> +<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*> +<!ATTLIST fieldset + %attrs; + > + +<!ENTITY % LAlign "(top|bottom|left|right)"> + +<!ELEMENT legend %Inline;> <!-- fieldset label --> +<!ATTLIST legend + %attrs; + accesskey %Character; #IMPLIED + align %LAlign; #IMPLIED + > + +<!-- + Content is %Flow; excluding a, form, form controls, iframe +--> +<!ELEMENT button %button.content;> <!-- push button --> +<!ATTLIST button + %attrs; + %focus; + name CDATA #IMPLIED + value CDATA #IMPLIED + type (button|submit|reset) "submit" + disabled (disabled) #IMPLIED + > + +<!-- single-line text input control (DEPRECATED) --> +<!ELEMENT isindex EMPTY> +<!ATTLIST isindex + %coreattrs; + %i18n; + prompt %Text; #IMPLIED + > + +<!--======================= Tables =======================================--> + +<!-- Derived from IETF HTML table standard, see [RFC1942] --> + +<!-- + The border attribute sets the thickness of the frame around the + table. The default units are screen pixels. + + The frame attribute specifies which parts of the frame around + the table should be rendered. The values are not the same as + CALS to avoid a name clash with the valign attribute. +--> +<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> + +<!-- + The rules attribute defines which rules to draw between cells: + + If rules is absent then assume: + "none" if border is absent or border="0" otherwise "all" +--> + +<!ENTITY % TRules "(none | groups | rows | cols | all)"> + +<!-- horizontal placement of table relative to document --> +<!ENTITY % TAlign "(left|center|right)"> + +<!-- horizontal alignment attributes for cell contents + + char alignment char, e.g. char=':' + charoff offset for alignment char +--> +<!ENTITY % cellhalign + "align (left|center|right|justify|char) #IMPLIED + char %Character; #IMPLIED + charoff %Length; #IMPLIED" + > + +<!-- vertical alignment attributes for cell contents --> +<!ENTITY % cellvalign + "valign (top|middle|bottom|baseline) #IMPLIED" + > + +<!ELEMENT table + (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> +<!ELEMENT caption %Inline;> +<!ELEMENT thead (tr)+> +<!ELEMENT tfoot (tr)+> +<!ELEMENT tbody (tr)+> +<!ELEMENT colgroup (col)*> +<!ELEMENT col EMPTY> +<!ELEMENT tr (th|td)+> +<!ELEMENT th %Flow;> +<!ELEMENT td %Flow;> + +<!ATTLIST table + %attrs; + summary %Text; #IMPLIED + width %Length; #IMPLIED + border %Pixels; #IMPLIED + frame %TFrame; #IMPLIED + rules %TRules; #IMPLIED + cellspacing %Length; #IMPLIED + cellpadding %Length; #IMPLIED + align %TAlign; #IMPLIED + bgcolor %Color; #IMPLIED + > + +<!ENTITY % CAlign "(top|bottom|left|right)"> + +<!ATTLIST caption + %attrs; + align %CAlign; #IMPLIED + > + +<!-- +colgroup groups a set of col elements. It allows you to group +several semantically related columns together. +--> +<!ATTLIST colgroup + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + col elements define the alignment properties for cells in + one or more columns. + + The width attribute specifies the width of the columns, e.g. + + width=64 width in screen pixels + width=0.5* relative width of 0.5 + + The span attribute causes the attributes of one + col element to apply to more than one column. +--> +<!ATTLIST col + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + Use thead to duplicate headers when breaking table + across page boundaries, or for static headers when + tbody sections are rendered in scrolling panel. + + Use tfoot to duplicate footers when breaking table + across page boundaries, or for static footers when + tbody sections are rendered in scrolling panel. + + Use multiple tbody sections when rules are needed + between groups of table rows. +--> +<!ATTLIST thead + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tfoot + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tbody + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tr + %attrs; + %cellhalign; + %cellvalign; + bgcolor %Color; #IMPLIED + > + +<!-- Scope is simpler than headers attribute for common tables --> +<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> + +<!-- th is for headers, td for data and for cells acting as both --> + +<!ATTLIST th + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Length; #IMPLIED + height %Length; #IMPLIED + > + +<!ATTLIST td + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Length; #IMPLIED + height %Length; #IMPLIED + > + diff --git a/dom/tests/mochitest/dom-level1-core/mochitest.ini b/dom/tests/mochitest/dom-level1-core/mochitest.ini new file mode 100644 index 0000000000..df96124a8d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/mochitest.ini @@ -0,0 +1,552 @@ +[DEFAULT] +support-files = + DOMTestCase.js + activity-home.css + exclusions.js + files/hc_nodtdstaff.html + files/hc_nodtdstaff.xhtml + files/hc_staff.html + files/hc_staff.xhtml + files/staff.dtd + files/staff.xml + files/svgunit.js + files/xhtml-special.ent + files/xhtml1-frameset.dtd + files/xhtml1-transitional.dtd + files/hc_nodtdstaff.svg + files/hc_nodtdstaff.xml + files/hc_staff.svg + files/hc_staff.xml + files/staff.svg + files/svgtest.js + files/xhtml-lat1.ent + files/xhtml-symbol.ent + files/xhtml1-strict.dtd + +[test_PIsetdatanomodificationallowederrEE.html] +[test_attrcreatedocumentfragment.html] +[test_attrcreatetextnode.html] +[test_attrcreatetextnode2.html] +[test_attrdefaultvalue.html] +[test_attreffectivevalue.html] +[test_attrentityreplacement.html] +[test_attrname.html] +[test_attrnextsiblingnull.html] +[test_attrnotspecifiedvalue.html] +[test_attrparentnodenull.html] +[test_attrprevioussiblingnull.html] +[test_attrremovechild1.html] +[test_attrreplacechild1.html] +[test_attrsetvaluenomodificationallowederr.html] +[test_attrsetvaluenomodificationallowederrEE.html] +[test_attrspecifiedvalue.html] +[test_attrspecifiedvaluechanged.html] +[test_attrspecifiedvalueremove.html] +[test_cdatasectiongetdata.html] +[test_cdatasectionnormalize.html] +[test_characterdataappenddata.html] +[test_characterdataappenddatagetdata.html] +[test_characterdataappenddatanomodificationallowederr.html] +[test_characterdataappenddatanomodificationallowederrEE.html] +[test_characterdatadeletedatabegining.html] +[test_characterdatadeletedataend.html] +[test_characterdatadeletedataexceedslength.html] +[test_characterdatadeletedatagetlengthanddata.html] +[test_characterdatadeletedatamiddle.html] +[test_characterdatadeletedatanomodificationallowederr.html] +[test_characterdatadeletedatanomodificationallowederrEE.html] +[test_characterdatagetdata.html] +[test_characterdatagetlength.html] +[test_characterdataindexsizeerrdeletedatacountnegative.html] +[test_characterdataindexsizeerrdeletedataoffsetgreater.html] +[test_characterdataindexsizeerrdeletedataoffsetnegative.html] +[test_characterdataindexsizeerrinsertdataoffsetgreater.html] +[test_characterdataindexsizeerrinsertdataoffsetnegative.html] +[test_characterdataindexsizeerrreplacedatacountnegative.html] +[test_characterdataindexsizeerrreplacedataoffsetgreater.html] +[test_characterdataindexsizeerrreplacedataoffsetnegative.html] +[test_characterdataindexsizeerrsubstringcountnegative.html] +[test_characterdataindexsizeerrsubstringnegativeoffset.html] +[test_characterdataindexsizeerrsubstringoffsetgreater.html] +[test_characterdatainsertdatabeginning.html] +[test_characterdatainsertdataend.html] +[test_characterdatainsertdatamiddle.html] +[test_characterdatainsertdatanomodificationallowederr.html] +[test_characterdatainsertdatanomodificationallowederrEE.html] +[test_characterdatareplacedatabegining.html] +[test_characterdatareplacedataend.html] +[test_characterdatareplacedataexceedslengthofarg.html] +[test_characterdatareplacedataexceedslengthofdata.html] +[test_characterdatareplacedatamiddle.html] +[test_characterdatareplacedatanomodificationallowederr.html] +[test_characterdatareplacedatanomodificationallowederrEE.html] +[test_characterdatasetdatanomodificationallowederr.html] +[test_characterdatasetdatanomodificationallowederrEE.html] +[test_characterdatasetnodevalue.html] +[test_characterdatasubstringexceedsvalue.html] +[test_characterdatasubstringvalue.html] +[test_commentgetcomment.html] +[test_documentcreateattribute.html] +[test_documentcreatecdatasection.html] +[test_documentcreatecomment.html] +[test_documentcreatedocumentfragment.html] +[test_documentcreateelement.html] +[test_documentcreateelementcasesensitive.html] +[test_documentcreateelementdefaultattr.html] +[test_documentcreateentityreference.html] +[test_documentcreateentityreferenceknown.html] +[test_documentcreateprocessinginstruction.html] +[test_documentcreatetextnode.html] +[test_documentgetdoctype.html] +[test_documentgetdoctypenodtd.html] +[test_documentgetelementsbytagnamelength.html] +[test_documentgetelementsbytagnametotallength.html] +[test_documentgetelementsbytagnamevalue.html] +[test_documentgetimplementation.html] +[test_documentgetrootnode.html] +[test_documentinvalidcharacterexceptioncreateattribute.html] +[test_documentinvalidcharacterexceptioncreateelement.html] +[test_documentinvalidcharacterexceptioncreateentref.html] +[test_documentinvalidcharacterexceptioncreateentref1.html] +[test_documentinvalidcharacterexceptioncreatepi.html] +[test_documentinvalidcharacterexceptioncreatepi1.html] +[test_documenttypegetdoctype.html] +[test_documenttypegetentities.html] +[test_documenttypegetentitieslength.html] +[test_documenttypegetentitiestype.html] +[test_documenttypegetnotations.html] +[test_documenttypegetnotationstype.html] +[test_domimplementationfeaturenoversion.html] +[test_domimplementationfeaturenull.html] +[test_domimplementationfeaturexml.html] +[test_elementaddnewattribute.html] +[test_elementassociatedattribute.html] +[test_elementchangeattributevalue.html] +[test_elementcreatenewattribute.html] +[test_elementgetattributenode.html] +[test_elementgetattributenodenull.html] +[test_elementgetelementempty.html] +[test_elementgetelementsbytagname.html] +[test_elementgetelementsbytagnameaccessnodelist.html] +[test_elementgetelementsbytagnamenomatch.html] +[test_elementgetelementsbytagnamespecialvalue.html] +[test_elementgettagname.html] +[test_elementinuseattributeerr.html] +[test_elementinvalidcharacterexception.html] +[test_elementnormalize.html] +[test_elementnotfounderr.html] +[test_elementremoveattribute.html] +[test_elementremoveattributeaftercreate.html] +[test_elementremoveattributenode.html] +[test_elementremoveattributenodenomodificationallowederr.html] +[test_elementremoveattributenodenomodificationallowederrEE.html] +[test_elementremoveattributenomodificationallowederr.html] +[test_elementremoveattributenomodificationallowederrEE.html] +[test_elementremoveattributerestoredefaultvalue.html] +[test_elementreplaceattributewithself.html] +[test_elementreplaceexistingattribute.html] +[test_elementreplaceexistingattributegevalue.html] +[test_elementretrieveallattributes.html] +[test_elementretrieveattrvalue.html] +[test_elementretrievetagname.html] +[test_elementsetattributenodenomodificationallowederr.html] +[test_elementsetattributenodenomodificationallowederrEE.html] +[test_elementsetattributenodenull.html] +[test_elementsetattributenomodificationallowederr.html] +[test_elementsetattributenomodificationallowederrEE.html] +[test_elementwrongdocumenterr.html] +[test_entitygetentityname.html] +[test_entitygetpublicid.html] +[test_entitygetpublicidnull.html] +[test_hc_attrappendchild1.html] +[test_hc_attrappendchild2.html] +[test_hc_attrappendchild3.html] +[test_hc_attrappendchild4.html] +[test_hc_attrappendchild5.html] +[test_hc_attrappendchild6.html] +[test_hc_attrchildnodes1.html] +[test_hc_attrchildnodes2.html] +[test_hc_attrclonenode1.html] +[test_hc_attrcreatedocumentfragment.html] +[test_hc_attrcreatetextnode.html] +[test_hc_attrcreatetextnode2.html] +[test_hc_attreffectivevalue.html] +[test_hc_attrfirstchild.html] +[test_hc_attrgetvalue1.html] +[test_hc_attrgetvalue2.html] +[test_hc_attrhaschildnodes.html] +[test_hc_attrinsertbefore1.html] +[test_hc_attrinsertbefore2.html] +[test_hc_attrinsertbefore3.html] +[test_hc_attrinsertbefore4.html] +[test_hc_attrinsertbefore5.html] +[test_hc_attrinsertbefore6.html] +[test_hc_attrinsertbefore7.html] +[test_hc_attrlastchild.html] +[test_hc_attrname.html] +[test_hc_attrnextsiblingnull.html] +[test_hc_attrnormalize.html] +[test_hc_attrparentnodenull.html] +[test_hc_attrprevioussiblingnull.html] +[test_hc_attrremovechild1.html] +[test_hc_attrremovechild2.html] +[test_hc_attrreplacechild1.html] +[test_hc_attrreplacechild2.html] +[test_hc_attrsetvalue1.html] +[test_hc_attrsetvalue2.html] +[test_hc_attrspecifiedvalue.html] +[test_hc_attrspecifiedvaluechanged.html] +[test_hc_characterdataappenddata.html] +[test_hc_characterdataappenddatagetdata.html] +[test_hc_characterdatadeletedatabegining.html] +[test_hc_characterdatadeletedataend.html] +[test_hc_characterdatadeletedataexceedslength.html] +[test_hc_characterdatadeletedatagetlengthanddata.html] +[test_hc_characterdatadeletedatamiddle.html] +[test_hc_characterdatagetdata.html] +[test_hc_characterdatagetlength.html] +[test_hc_characterdataindexsizeerrdeletedatacountnegative.html] +[test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html] +[test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html] +[test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html] +[test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html] +[test_hc_characterdataindexsizeerrreplacedatacountnegative.html] +[test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html] +[test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html] +[test_hc_characterdataindexsizeerrsubstringcountnegative.html] +[test_hc_characterdataindexsizeerrsubstringnegativeoffset.html] +[test_hc_characterdataindexsizeerrsubstringoffsetgreater.html] +[test_hc_characterdatainsertdatabeginning.html] +[test_hc_characterdatainsertdataend.html] +[test_hc_characterdatainsertdatamiddle.html] +[test_hc_characterdatareplacedatabegining.html] +[test_hc_characterdatareplacedataend.html] +[test_hc_characterdatareplacedataexceedslengthofarg.html] +[test_hc_characterdatareplacedataexceedslengthofdata.html] +[test_hc_characterdatareplacedatamiddle.html] +[test_hc_characterdatasetnodevalue.html] +[test_hc_characterdatasubstringexceedsvalue.html] +[test_hc_characterdatasubstringvalue.html] +[test_hc_commentgetcomment.html] +[test_hc_documentcreateattribute.html] +[test_hc_documentcreatecomment.html] +[test_hc_documentcreatedocumentfragment.html] +[test_hc_documentcreateelement.html] +[test_hc_documentcreateelementcasesensitive.html] +[test_hc_documentcreatetextnode.html] +[test_hc_documentgetdoctype.html] +[test_hc_documentgetelementsbytagnamelength.html] +[test_hc_documentgetelementsbytagnametotallength.html] +[test_hc_documentgetelementsbytagnamevalue.html] +[test_hc_documentgetimplementation.html] +[test_hc_documentgetrootnode.html] +[test_hc_documentinvalidcharacterexceptioncreateattribute.html] +[test_hc_documentinvalidcharacterexceptioncreateattribute1.html] +[test_hc_documentinvalidcharacterexceptioncreateelement.html] +[test_hc_documentinvalidcharacterexceptioncreateelement1.html] +[test_hc_domimplementationfeaturenoversion.html] +[test_hc_domimplementationfeaturenull.html] +[test_hc_domimplementationfeaturexml.html] +[test_hc_elementaddnewattribute.html] +[test_hc_elementassociatedattribute.html] +[test_hc_elementchangeattributevalue.html] +[test_hc_elementcreatenewattribute.html] +[test_hc_elementgetattributenode.html] +[test_hc_elementgetattributenodenull.html] +[test_hc_elementgetelementempty.html] +[test_hc_elementgetelementsbytagname.html] +[test_hc_elementgetelementsbytagnameaccessnodelist.html] +[test_hc_elementgetelementsbytagnamenomatch.html] +[test_hc_elementgetelementsbytagnamespecialvalue.html] +[test_hc_elementgettagname.html] +[test_hc_elementinuseattributeerr.html] +[test_hc_elementinvalidcharacterexception.html] +[test_hc_elementinvalidcharacterexception1.html] +[test_hc_elementnormalize.html] +[test_hc_elementnormalize2.html] +[test_hc_elementnotfounderr.html] +[test_hc_elementremoveattribute.html] +[test_hc_elementremoveattributeaftercreate.html] +[test_hc_elementremoveattributenode.html] +[test_hc_elementreplaceattributewithself.html] +[test_hc_elementreplaceexistingattribute.html] +[test_hc_elementreplaceexistingattributegevalue.html] +[test_hc_elementretrieveallattributes.html] +[test_hc_elementretrieveattrvalue.html] +[test_hc_elementretrievetagname.html] +[test_hc_elementsetattributenodenull.html] +[test_hc_elementwrongdocumenterr.html] +[test_hc_entitiesremovenameditem1.html] +[test_hc_entitiessetnameditem1.html] +[test_hc_namednodemapchildnoderange.html] +[test_hc_namednodemapgetnameditem.html] +[test_hc_namednodemapinuseattributeerr.html] +[test_hc_namednodemapnotfounderr.html] +[test_hc_namednodemapnumberofnodes.html] +[test_hc_namednodemapremovenameditem.html] +[test_hc_namednodemapreturnattrnode.html] +[test_hc_namednodemapreturnfirstitem.html] +[test_hc_namednodemapreturnlastitem.html] +[test_hc_namednodemapreturnnull.html] +[test_hc_namednodemapsetnameditem.html] +[test_hc_namednodemapsetnameditemreturnvalue.html] +[test_hc_namednodemapsetnameditemthatexists.html] +[test_hc_namednodemapsetnameditemwithnewvalue.html] +[test_hc_namednodemapwrongdocumenterr.html] +[test_hc_nodeappendchild.html] +[test_hc_nodeappendchildchildexists.html] +[test_hc_nodeappendchilddocfragment.html] +[test_hc_nodeappendchildgetnodename.html] +[test_hc_nodeappendchildinvalidnodetype.html] +[test_hc_nodeappendchildnewchilddiffdocument.html] +[test_hc_nodeappendchildnodeancestor.html] +[test_hc_nodeattributenodeattribute.html] +[test_hc_nodeattributenodename.html] +[test_hc_nodeattributenodetype.html] +[test_hc_nodeattributenodevalue.html] +[test_hc_nodechildnodes.html] +[test_hc_nodechildnodesappendchild.html] +[test_hc_nodechildnodesempty.html] +[test_hc_nodecloneattributescopied.html] +[test_hc_nodeclonefalsenocopytext.html] +[test_hc_nodeclonegetparentnull.html] +[test_hc_nodeclonenodefalse.html] +[test_hc_nodeclonenodetrue.html] +[test_hc_nodeclonetruecopytext.html] +[test_hc_nodecommentnodeattributes.html] +[test_hc_nodecommentnodename.html] +[test_hc_nodecommentnodetype.html] +[test_hc_nodecommentnodevalue.html] +[test_hc_nodedocumentfragmentnodename.html] +[test_hc_nodedocumentfragmentnodetype.html] +[test_hc_nodedocumentfragmentnodevalue.html] +[test_hc_nodedocumentnodeattribute.html] +[test_hc_nodedocumentnodename.html] +[test_hc_nodedocumentnodetype.html] +[test_hc_nodedocumentnodevalue.html] +[test_hc_nodeelementnodeattributes.html] +[test_hc_nodeelementnodename.html] +[test_hc_nodeelementnodetype.html] +[test_hc_nodeelementnodevalue.html] +[test_hc_nodegetfirstchild.html] +[test_hc_nodegetfirstchildnull.html] +[test_hc_nodegetlastchild.html] +[test_hc_nodegetlastchildnull.html] +[test_hc_nodegetnextsibling.html] +[test_hc_nodegetnextsiblingnull.html] +[test_hc_nodegetownerdocument.html] +[test_hc_nodegetownerdocumentnull.html] +[test_hc_nodegetprevioussibling.html] +[test_hc_nodegetprevioussiblingnull.html] +[test_hc_nodehaschildnodes.html] +[test_hc_nodehaschildnodesfalse.html] +[test_hc_nodeinsertbefore.html] +[test_hc_nodeinsertbeforedocfragment.html] +[test_hc_nodeinsertbeforeinvalidnodetype.html] +[test_hc_nodeinsertbeforenewchilddiffdocument.html] +[test_hc_nodeinsertbeforenewchildexists.html] +[test_hc_nodeinsertbeforenodeancestor.html] +[test_hc_nodeinsertbeforenodename.html] +[test_hc_nodeinsertbeforerefchildnonexistent.html] +[test_hc_nodeinsertbeforerefchildnull.html] +[test_hc_nodelistindexequalzero.html] +[test_hc_nodelistindexgetlength.html] +[test_hc_nodelistindexgetlengthofemptylist.html] +[test_hc_nodelistindexnotzero.html] +[test_hc_nodelistreturnfirstitem.html] +[test_hc_nodelistreturnlastitem.html] +[test_hc_nodelisttraverselist.html] +[test_hc_nodeparentnode.html] +[test_hc_nodeparentnodenull.html] +[test_hc_noderemovechild.html] +[test_hc_noderemovechildgetnodename.html] +[test_hc_noderemovechildnode.html] +[test_hc_noderemovechildoldchildnonexistent.html] +[test_hc_nodereplacechild.html] +[test_hc_nodereplacechildinvalidnodetype.html] +[test_hc_nodereplacechildnewchilddiffdocument.html] +[test_hc_nodereplacechildnewchildexists.html] +[test_hc_nodereplacechildnodeancestor.html] +[test_hc_nodereplacechildnodename.html] +[test_hc_nodereplacechildoldchildnonexistent.html] +[test_hc_nodetextnodeattribute.html] +[test_hc_nodetextnodename.html] +[test_hc_nodetextnodetype.html] +[test_hc_nodetextnodevalue.html] +[test_hc_nodevalue01.html] +[test_hc_nodevalue02.html] +[test_hc_nodevalue03.html] +[test_hc_nodevalue04.html] +[test_hc_nodevalue05.html] +[test_hc_nodevalue06.html] +[test_hc_nodevalue07.html] +[test_hc_nodevalue08.html] +[test_hc_notationsremovenameditem1.html] +[test_hc_notationssetnameditem1.html] +[test_hc_textindexsizeerrnegativeoffset.html] +[test_hc_textindexsizeerroffsetoutofbounds.html] +[test_hc_textparseintolistofelements.html] +[test_hc_textsplittextfour.html] +[test_hc_textsplittextone.html] +[test_hc_textsplittextthree.html] +[test_hc_textsplittexttwo.html] +[test_hc_textwithnomarkup.html] +[test_namednodemapchildnoderange.html] +[test_namednodemapgetnameditem.html] +[test_namednodemapinuseattributeerr.html] +[test_namednodemapnotfounderr.html] +[test_namednodemapnumberofnodes.html] +[test_namednodemapremovenameditem.html] +[test_namednodemapremovenameditemgetvalue.html] +[test_namednodemapremovenameditemreturnnodevalue.html] +[test_namednodemapreturnattrnode.html] +[test_namednodemapreturnfirstitem.html] +[test_namednodemapreturnlastitem.html] +[test_namednodemapreturnnull.html] +[test_namednodemapsetnameditem.html] +[test_namednodemapsetnameditemreturnvalue.html] +[test_namednodemapsetnameditemthatexists.html] +[test_namednodemapsetnameditemwithnewvalue.html] +[test_namednodemapwrongdocumenterr.html] +[test_nodeappendchild.html] +[test_nodeappendchildchildexists.html] +[test_nodeappendchilddocfragment.html] +[test_nodeappendchildgetnodename.html] +[test_nodeappendchildinvalidnodetype.html] +[test_nodeappendchildnewchilddiffdocument.html] +[test_nodeappendchildnodeancestor.html] +[test_nodeappendchildnomodificationallowederr.html] +[test_nodeappendchildnomodificationallowederrEE.html] +[test_nodeattributenodeattribute.html] +[test_nodeattributenodename.html] +[test_nodeattributenodetype.html] +[test_nodeattributenodevalue.html] +[test_nodecdatasectionnodeattribute.html] +[test_nodecdatasectionnodename.html] +[test_nodecdatasectionnodetype.html] +[test_nodecdatasectionnodevalue.html] +[test_nodechildnodes.html] +[test_nodechildnodesappendchild.html] +[test_nodechildnodesempty.html] +[test_nodecloneattributescopied.html] +[test_nodeclonefalsenocopytext.html] +[test_nodeclonegetparentnull.html] +[test_nodeclonenodefalse.html] +[test_nodeclonenodetrue.html] +[test_nodeclonetruecopytext.html] +[test_nodecommentnodeattributes.html] +[test_nodecommentnodename.html] +[test_nodecommentnodetype.html] +[test_nodecommentnodevalue.html] +[test_nodedocumentfragmentnodename.html] +[test_nodedocumentfragmentnodetype.html] +[test_nodedocumentfragmentnodevalue.html] +[test_nodedocumentnodeattribute.html] +[test_nodedocumentnodename.html] +[test_nodedocumentnodetype.html] +[test_nodedocumentnodevalue.html] +[test_nodedocumenttypenodename.html] +[test_nodedocumenttypenodetype.html] +[test_nodedocumenttypenodevalue.html] +[test_nodeelementnodeattributes.html] +[test_nodeelementnodename.html] +[test_nodeelementnodetype.html] +[test_nodeelementnodevalue.html] +[test_nodeentitynodeattributes.html] +[test_nodeentitynodename.html] +[test_nodeentitynodetype.html] +[test_nodeentitynodevalue.html] +[test_nodeentityreferencenodeattributes.html] +[test_nodeentityreferencenodename.html] +[test_nodeentityreferencenodetype.html] +[test_nodeentityreferencenodevalue.html] +[test_nodeentitysetnodevalue.html] +[test_nodegetfirstchild.html] +[test_nodegetfirstchildnull.html] +[test_nodegetlastchild.html] +[test_nodegetlastchildnull.html] +[test_nodegetnextsibling.html] +[test_nodegetnextsiblingnull.html] +[test_nodegetownerdocument.html] +[test_nodegetownerdocumentnull.html] +[test_nodegetprevioussibling.html] +[test_nodegetprevioussiblingnull.html] +[test_nodehaschildnodes.html] +[test_nodehaschildnodesfalse.html] +[test_nodeinsertbefore.html] +[test_nodeinsertbeforedocfragment.html] +[test_nodeinsertbeforeinvalidnodetype.html] +[test_nodeinsertbeforenewchilddiffdocument.html] +[test_nodeinsertbeforenewchildexists.html] +[test_nodeinsertbeforenodeancestor.html] +[test_nodeinsertbeforenodename.html] +[test_nodeinsertbeforenomodificationallowederr.html] +[test_nodeinsertbeforenomodificationallowederrEE.html] +[test_nodeinsertbeforerefchildnonexistent.html] +[test_nodeinsertbeforerefchildnull.html] +[test_nodelistindexequalzero.html] +[test_nodelistindexgetlength.html] +[test_nodelistindexgetlengthofemptylist.html] +[test_nodelistindexnotzero.html] +[test_nodelistreturnfirstitem.html] +[test_nodelistreturnlastitem.html] +[test_nodelisttraverselist.html] +[test_nodenotationnodeattributes.html] +[test_nodenotationnodename.html] +[test_nodenotationnodetype.html] +[test_nodenotationnodevalue.html] +[test_nodeparentnode.html] +[test_nodeparentnodenull.html] +[test_nodeprocessinginstructionnodeattributes.html] +[test_nodeprocessinginstructionnodename.html] +[test_nodeprocessinginstructionnodetype.html] +[test_nodeprocessinginstructionnodevalue.html] +[test_nodeprocessinginstructionsetnodevalue.html] +[test_noderemovechild.html] +[test_noderemovechildgetnodename.html] +[test_noderemovechildnode.html] +[test_noderemovechildnomodificationallowederr.html] +[test_noderemovechildnomodificationallowederrEE.html] +[test_noderemovechildoldchildnonexistent.html] +[test_nodereplacechild.html] +[test_nodereplacechildinvalidnodetype.html] +[test_nodereplacechildnewchilddiffdocument.html] +[test_nodereplacechildnewchildexists.html] +[test_nodereplacechildnodeancestor.html] +[test_nodereplacechildnodename.html] +[test_nodereplacechildnomodificationallowederr.html] +[test_nodereplacechildnomodificationallowederrEE.html] +[test_nodereplacechildoldchildnonexistent.html] +[test_nodesetnodevaluenomodificationallowederr.html] +[test_nodesetnodevaluenomodificationallowederrEE.html] +[test_nodetextnodeattribute.html] +[test_nodetextnodename.html] +[test_nodetextnodetype.html] +[test_nodetextnodevalue.html] +[test_nodevalue01.html] +[test_nodevalue02.html] +[test_nodevalue03.html] +[test_nodevalue04.html] +[test_nodevalue05.html] +[test_nodevalue06.html] +[test_nodevalue07.html] +[test_nodevalue08.html] +[test_nodevalue09.html] +[test_notationgetnotationname.html] +[test_notationgetpublicid.html] +[test_notationgetpublicidnull.html] +[test_notationgetsystemid.html] +[test_notationgetsystemidnull.html] +[test_processinginstructiongetdata.html] +[test_processinginstructiongettarget.html] +[test_processinginstructionsetdatanomodificationallowederr.html] +[test_textindexsizeerrnegativeoffset.html] +[test_textindexsizeerroffsetoutofbounds.html] +[test_textparseintolistofelements.html] +[test_textsplittextfour.html] +[test_textsplittextnomodificationallowederr.html] +[test_textsplittextnomodificationallowederrEE.html] +[test_textsplittextone.html] +[test_textsplittextthree.html] +[test_textsplittexttwo.html] +[test_textwithnomarkup.html] diff --git a/dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html new file mode 100644 index 0000000000..0dc730a5c0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_PIsetdatanomodificationallowederrEE.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['processinginstructionsetdatanomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'processinginstructionsetdatanomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setData(data)" method for a processing instruction causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an ent4 entity reference and add to document of the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "setData(data)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-837822393')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0053.html +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr.xml +*/ +function processinginstructionsetdatanomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "processinginstructionsetdatanomodificationallowederrEE") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var piNode; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = doc.createEntityReference("ent4"); + appendedChild = gender.appendChild(entRef); + entRef = gender.lastChild; + + assertNotNull("entRefNotNull",entRef); +piNode = entRef.lastChild; + + assertNotNull("piNodeNotNull",piNode); + + { + success = false; + try { + piNode.data = "newData"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html new file mode 100644 index 0000000000..1b82e46edd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrcreatedocumentfragment.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatedocumentfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrcreatedocumentfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrcreatedocumentfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Attr nodes may be associated with Element nodes contained within a DocumentFragment. + Create a new DocumentFragment and add a newly created Element node(with one attribute). + Once the element is added, its attribute should be available as an attribute associated + with an Element within a DocumentFragment. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function attrcreatedocumentfragment() { + var success; + if(checkInitialization(builder, "attrcreatedocumentfragment") != null) return; + var doc; + var docFragment; + var newOne; + var domesticNode; + var domesticAttr; + var attrs; + var attrName; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docFragment = doc.createDocumentFragment(); + newOne = doc.createElement("newElement"); + newOne.setAttribute("newdomestic","Yes"); + appendedChild = docFragment.appendChild(newOne); + domesticNode = docFragment.firstChild; + + domesticAttr = domesticNode.attributes; + + attrs = domesticAttr.item(0); + attrName = attrs.name; + + assertEquals("attrCreateDocumentFragmentAssert","newdomestic",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatedocumentfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html new file mode 100644 index 0000000000..eb76fc3c6a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrcreatetextnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrcreatetextnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setValue()" method for an attribute creates a + Text node with the unparsed content of the string. + Retrieve the attribute named "street" from the last + child of of the fourth employee and assign the "Y&ent1;" + string to its value attribute. This value is not yet + parsed and therefore should still be the same upon + retrieval. This test uses the "getNamedItem(name)" method + from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html +*/ +function attrcreatetextnode() { + var success; + if(checkInitialization(builder, "attrcreatetextnode") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(3); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + streetAttr.value = "Y&ent1;"; + + value = streetAttr.value; + + assertEquals("value","Y&ent1;",value); + value = streetAttr.nodeValue; + + assertEquals("nodeValue","Y&ent1;",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html new file mode 100644 index 0000000000..7ea58109cb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrcreatetextnode2.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrcreatetextnode2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrcreatetextnode2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNodeValue()" method for an attribute creates a + Text node with the unparsed content of the string. + Retrieve the attribute named "street" from the last + child of of the fourth employee and assign the "Y&ent1;" + string to its value attribute. This value is not yet + parsed and therefore should still be the same upon + retrieval. This test uses the "getNamedItem(name)" method + from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html +*/ +function attrcreatetextnode2() { + var success; + if(checkInitialization(builder, "attrcreatetextnode2") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(3); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + streetAttr.nodeValue = "Y&ent1;"; + + value = streetAttr.value; + + assertEquals("value","Y&ent1;",value); + value = streetAttr.nodeValue; + + assertEquals("nodeValue","Y&ent1;",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html b/dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html new file mode 100644 index 0000000000..03628ff43d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrdefaultvalue.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrdefaultvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrdefaultvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrdefaultvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If there is not an explicit value assigned to an attribute + and there is a declaration for this attribute and that + declaration includes a default value, then that default + value is the attributes default value. + Retrieve the attribute named "street" from the last + child of of the first employee and examine its + value. That value should be the value given the + attribute in the DTD file. The test uses the + "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function attrdefaultvalue() { + var success; + if(checkInitialization(builder, "attrdefaultvalue") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + value = streetAttr.nodeValue; + + assertEquals("attrDefaultValueAssert","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrdefaultvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html b/dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html new file mode 100644 index 0000000000..ace800dd1f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attreffectivevalue.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attreffectivevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attreffectivevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attreffectivevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If an Attr is explicitly assigned any value, then that value is the attributes effective value. + Retrieve the attribute named "domestic" from the last child of of the first employee + and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method + from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +*/ +function attreffectivevalue() { + var success; + if(checkInitialization(builder, "attreffectivevalue") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + value = domesticAttr.nodeValue; + + assertEquals("attrEffectiveValueAssert","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attreffectivevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html b/dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html new file mode 100644 index 0000000000..ddb9ec758f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrentityreplacement.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrentityreplacement</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrentityreplacement']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrentityreplacement'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getValue()" method will return the value of the + attribute as a string. The general entity references + are replaced with their values. + Retrieve the attribute named "street" from the last + child of of the fourth employee and examine the string + returned by the "getValue()" method. The value should + be set to "Yes" after the EntityReference is + replaced with its value. This test uses the + "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +*/ +function attrentityreplacement() { + var success; + if(checkInitialization(builder, "attrentityreplacement") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(3); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + value = streetAttr.value; + + assertEquals("streetYes","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrentityreplacement</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrname.html b/dom/tests/mochitest/dom-level1-core/test_attrname.html new file mode 100644 index 0000000000..fbed36f594 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrname.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The getNodeName() method of an Attribute node. + Retrieve the attribute named street from the last + child of of the second employee and examine its + NodeName. This test uses the getNamedItem(name) method from the NamedNodeMap + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 +*/ +function attrname() { + var success; + if(checkInitialization(builder, "attrname") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(1); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + name = streetAttr.nodeName; + + assertEquals("nodeName","street",name); + name = streetAttr.name; + + assertEquals("name","street",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html new file mode 100644 index 0000000000..41731b7523 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrnextsiblingnull.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnextsiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrnextsiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrnextsiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getNextSibling()" method for an Attr node should return null. +Retrieve the attribute named "domestic" from the last child of of the +first employee and examine its NextSibling node. This test uses the +"getNamedItem(name)" method from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function attrnextsiblingnull() { + var success; + if(checkInitialization(builder, "attrnextsiblingnull") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var s; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + s = domesticAttr.nextSibling; + + assertNull("attrNextSiblingNullAssert",s); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnextsiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html b/dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html new file mode 100644 index 0000000000..a7f2ab526a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrnotspecifiedvalue.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrnotspecifiedvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrnotspecifiedvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getSpecified()" method for an Attr node should + be set to false if the attribute was not explicitly given + a value. + Retrieve the attribute named "street" from the last + child of of the first employee and examine the value + returned by the "getSpecified()" method. This test uses + the "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function attrnotspecifiedvalue() { + var success; + if(checkInitialization(builder, "attrnotspecifiedvalue") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + state = streetAttr.specified; + + assertFalse("streetNotSpecified",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html new file mode 100644 index 0000000000..19c3513353 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrparentnodenull.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrparentnodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrparentnodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrparentnodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getParentNode()" method for an Attr node should return null. Retrieve +the attribute named "domestic" from the last child of the first employee +and examine its parentNode attribute. This test also uses the "getNamedItem(name)" +method from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function attrparentnodenull() { + var success; + if(checkInitialization(builder, "attrparentnodenull") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var s; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + s = domesticAttr.parentNode; + + assertNull("attrParentNodeNullAssert",s); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrparentnodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html new file mode 100644 index 0000000000..47bb7c1110 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrprevioussiblingnull.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrprevioussiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrprevioussiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrprevioussiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getPreviousSibling()" method for an Attr node should return null. +Retrieve the attribute named "domestic" from the last child of of the +first employee and examine its PreviousSibling node. This test uses the +"getNamedItem(name)" method from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function attrprevioussiblingnull() { + var success; + if(checkInitialization(builder, "attrprevioussiblingnull") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var s; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + s = domesticAttr.previousSibling; + + assertNull("attrPreviousSiblingNullAssert",s); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrprevioussiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html b/dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html new file mode 100644 index 0000000000..3ef32c9c6c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrremovechild1.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrremovechild1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrremovechild1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Removing a child node from an attribute in an entity reference +should result in an NO_MODIFICATION_ALLOWED_ERR DOMException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function attrremovechild1() { + var success; + if(checkInitialization(builder, "attrremovechild1") != null) return; + var doc; + var entRef; + var entElement; + var attrNode; + var textNode; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +attrNode = entElement.getAttributeNode("domestic"); + textNode = attrNode.firstChild; + + assertNotNull("attrChildNotNull",textNode); + + { + success = false; + try { + removedNode = attrNode.removeChild(textNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("setValue_throws_NO_MODIFICATION_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html b/dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html new file mode 100644 index 0000000000..4b7e4a7ef5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrreplacechild1.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrreplacechild1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrreplacechild1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrreplacechild1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Replacing a child node from an attribute in an entity reference +should result in an NO_MODIFICATION_ALLOWED_ERR DOMException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function attrreplacechild1() { + var success; + if(checkInitialization(builder, "attrreplacechild1") != null) return; + var doc; + var entRef; + var entElement; + var attrNode; + var textNode; + var removedNode; + var newChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +attrNode = entElement.getAttributeNode("domestic"); + textNode = attrNode.firstChild; + + assertNotNull("attrChildNotNull",textNode); +newChild = doc.createTextNode("Yesterday"); + + { + success = false; + try { + removedNode = attrNode.replaceChild(newChild,textNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("setValue_throws_NO_MODIFICATION_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrreplacechild1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html new file mode 100644 index 0000000000..3d53998a7d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederr.html @@ -0,0 +1,175 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrsetvaluenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("expandEntityReferences", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrsetvaluenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setValue()" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the "domestic" attribute + from the entity reference and execute the "setValue()" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474 +* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +*/ +function attrsetvaluenomodificationallowederr() { + var success; + if(checkInitialization(builder, "attrsetvaluenomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var genList; + var gen; + var gList; + var g; + var attrList; + var attrNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + assertNotNull("genderNotNull",gender); +genList = gender.childNodes; + + gen = genList.item(0); + assertNotNull("genderFirstChildNotNull",gen); +gList = gen.childNodes; + + g = gList.item(0); + assertNotNull("genderFirstGrandchildNotNull",g); +attrList = g.attributes; + + assertNotNull("attributesNotNull",attrList); +attrNode = attrList.getNamedItem("domestic"); + assertNotNull("attrNotNull",attrNode); + + { + success = false; + try { + attrNode.value = "newvalue"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("setValue_throws_NO_MODIFICATION",success); + } + + { + success = false; + try { + attrNode.nodeValue = "newvalue2"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("setNodeValue_throws_NO_MODIFICATION",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html new file mode 100644 index 0000000000..2615060115 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrsetvaluenomodificationallowederrEE.html @@ -0,0 +1,170 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrsetvaluenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrsetvaluenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setValue()" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an entity reference using document.createEntityReference() + Get the "domestic" attribute from the entity + reference and execute the "setValue()" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474 +* @see http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr.xml +*/ +function attrsetvaluenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "attrsetvaluenomodificationallowederrEE") != null) return; + var doc; + var entRef; + var entElement; + var attrList; + var attrNode; + var gender; + var genderList; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + assertNotNull("genderNotNull",gender); +entRef = doc.createEntityReference("ent4"); + assertNotNull("entRefNotNull",entRef); +appendedChild = gender.appendChild(entRef); + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +attrList = entElement.attributes; + + attrNode = attrList.getNamedItem("domestic"); + + { + success = false; + try { + attrNode.value = "newvalue"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("setValue_throws_NO_MODIFICATION",success); + } + + { + success = false; + try { + attrNode.nodeValue = "newvalue2"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("setNodeValue_throws_NO_MODIFICATION",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html new file mode 100644 index 0000000000..59b2a45fe5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalue.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrspecifiedvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrspecifiedvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getSpecified()" method for an Attr node should + be set to true if the attribute was explicitly given + a value. + Retrieve the attribute named "domestic" from the last + child of of the first employee and examine the value + returned by the "getSpecified()" method. This test uses + the "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 +*/ +function attrspecifiedvalue() { + var success; + if(checkInitialization(builder, "attrspecifiedvalue") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + state = domesticAttr.specified; + + assertTrue("domesticSpecified",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html new file mode 100644 index 0000000000..151ac4ce45 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvaluechanged.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvaluechanged</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrspecifiedvaluechanged']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrspecifiedvaluechanged'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getSpecified()" method for an Attr node should return true if the + value of the attribute is changed. + Retrieve the attribute named "street" from the last + child of of the THIRD employee and change its + value to "Yes"(which is the default DTD value). This + should cause the "getSpecified()" method to be true. + This test uses the "setAttribute(name,value)" method + from the Element interface and the "getNamedItem(name)" + method from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 +*/ +function attrspecifiedvaluechanged() { + var success; + if(checkInitialization(builder, "attrspecifiedvaluechanged") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(2); + testNode.setAttribute("street","Yes"); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + state = streetAttr.specified; + + assertTrue("streetSpecified",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvaluechanged</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html new file mode 100644 index 0000000000..b55c449e08 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_attrspecifiedvalueremove.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalueremove</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrspecifiedvalueremove']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrspecifiedvalueremove'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +To respecify the attribute to its default value from +the DTD, the attribute must be deleted. This will then +make a new attribute available with the "getSpecified()" +method value set to false. +Retrieve the attribute named "street" from the last +child of of the THIRD employee and delete it. This +should then create a new attribute with its default +value and also cause the "getSpecified()" method to +return false. +This test uses the "removeAttribute(name)" method +from the Element interface and the "getNamedItem(name)" +method from the NamedNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function attrspecifiedvalueremove() { + var success; + if(checkInitialization(builder, "attrspecifiedvalueremove") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(2); + testNode.removeAttribute("street"); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("street"); + assertNotNull("streetAttrNotNull",streetAttr); +state = streetAttr.specified; + + assertFalse("attrSpecifiedValueRemoveAssert",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalueremove</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html b/dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html new file mode 100644 index 0000000000..e174a55ec2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_cdatasectiongetdata.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectiongetdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['cdatasectiongetdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("coalescing", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'cdatasectiongetdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Retrieve the last CDATASection node located inside the +second child of the second employee and examine its +content. Since the CDATASection interface inherits +from the CharacterData interface(via the Text node), +the "getData()" method can be used to access the +CDATA content. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +*/ +function cdatasectiongetdata() { + var success; + if(checkInitialization(builder, "cdatasectiongetdata") != null) return; + var doc; + var nameList; + var child; + var lastChild; + var data; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + nameList = doc.getElementsByTagName("name"); + child = nameList.item(1); + lastChild = child.lastChild; + + nodeType = lastChild.nodeType; + + assertEquals("isCDATA",4,nodeType); + data = lastChild.data; + + assertEquals("data","This is an adjacent CDATASection with a reference to a tab &tab;",data); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectiongetdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html b/dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html new file mode 100644 index 0000000000..4f5d99621e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_cdatasectionnormalize.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectionnormalize</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['cdatasectionnormalize']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'cdatasectionnormalize'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Adjacent CDATASection nodes cannot be merged together by +use of the "normalize()" method from the Element interface. +Retrieve second child of the second employee and invoke +the "normalize()" method. The Element under contains +two CDATASection nodes that should not be merged together +by the "normalize()" method. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 +*/ +function cdatasectionnormalize() { + var success; + if(checkInitialization(builder, "cdatasectionnormalize") != null) return; + var doc; + var nameList; + var lChild; + var childNodes; + var cdataN; + var data; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + nameList = doc.getElementsByTagName("name"); + lChild = nameList.item(1); + lChild.normalize(); + childNodes = lChild.childNodes; + + cdataN = childNodes.item(1); + assertNotNull("firstCDATASection",cdataN); +data = cdataN.data; + + assertEquals("data1","This is a CDATASection with EntityReference number 2 &ent2;",data); + cdataN = childNodes.item(3); + assertNotNull("secondCDATASection",cdataN); +data = cdataN.data; + + assertEquals("data3","This is an adjacent CDATASection with a reference to a tab &tab;",data); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectionnormalize</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html new file mode 100644 index 0000000000..e15f9ca7c9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddata.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataappenddata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataappenddata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendData(arg)" method appends a string to the end + of the character data of the node. + + Retrieve the character data from the second child + of the first employee. The appendData(arg) method is + called with arg=", Esquire". The method should append + the specified data to the already existing character + data. The new value return by the "getLength()" method + should be 24. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +*/ +function characterdataappenddata() { + var success; + if(checkInitialization(builder, "characterdataappenddata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childValue; + var childLength; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.appendData(", Esquire"); + childValue = child.data; + + childLength = childValue.length; + assertEquals("characterdataAppendDataAssert",24,childLength); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html new file mode 100644 index 0000000000..d3e8f5d525 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatagetdata.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatagetdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataappenddatagetdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataappenddatagetdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + On successful invocation of the "appendData(arg)" + method the "getData()" method provides access to the + concatentation of data and the specified string. + + Retrieve the character data from the second child + of the first employee. The appendData(arg) method is + called with arg=", Esquire". The method should append + the specified data to the already existing character + data. The new value return by the "getData()" method + should be "Margaret Martin, Esquire". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +*/ +function characterdataappenddatagetdata() { + var success; + if(checkInitialization(builder, "characterdataappenddatagetdata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.appendData(", Esquire"); + childData = child.data; + + assertEquals("characterdataAppendDataGetDataAssert","Margaret Martin, Esquire",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatagetdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html new file mode 100644 index 0000000000..d2cda40d34 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederr.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataappenddatanomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataappenddatanomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendData(arg)" method raises a NO_MODIFICATION_ALLOWED_ERR + DOMException if the node is readonly. + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "appendData(arg)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +*/ +function characterdataappenddatanomodificationallowederr() { + var success; + if(checkInitialization(builder, "characterdataappenddatanomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entElement; + var entElementContent; + var entReference; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = genderNode.firstChild; + + assertNotNull("entReferenceNotNull",entReference); +nodeType = entReference.nodeType; + + + if( + (1 == nodeType) + ) { + entReference = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entReference); + + } + entElement = entReference.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementContent = entElement.firstChild; + + assertNotNull("entElementContentNotNull",entElementContent); + + { + success = false; + try { + entElementContent.appendData("newString"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html new file mode 100644 index 0000000000..4704393ad5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataappenddatanomodificationallowederrEE.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataappenddatanomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataappenddatanomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Create an ent3 entity reference and call appendData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr.xml +*/ +function characterdataappenddatanomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "characterdataappenddatanomodificationallowederrEE") != null) return; + var doc; + var genderList; + var genderNode; + var entText; + var entReference; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entReference); +appendedChild = genderNode.appendChild(entReference); + entText = entReference.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + entText.appendData("newString"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html new file mode 100644 index 0000000000..fa72f32fc7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatabegining.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatabegining</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedatabegining']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedatabegining'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "deleteData(offset,count)" method removes a range of +characters from the node. Delete data at the beginning +of the character data. + +Retrieve the character data from the last child of the +first employee. The "deleteData(offset,count)" +method is then called with offset=0 and count=16. +The method should delete the characters from position +0 thru position 16. The new value of the character data +should be "Dallas, Texas 98551". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdatadeletedatabegining() { + var success; + if(checkInitialization(builder, "characterdatadeletedatabegining") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(0,16); + childData = child.data; + + assertEquals("characterdataDeleteDataBeginingAssert","Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatabegining</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html new file mode 100644 index 0000000000..92e4ae7aa3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataend.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataend</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedataend']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedataend'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method removes a range of + characters from the node. Delete data at the end + of the character data. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=30 and count=5. + The method should delete the characters from position + 30 thru position 35. The new value of the character data + should be "1230 North Ave. Dallas, Texas". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdatadeletedataend() { + var success; + if(checkInitialization(builder, "characterdatadeletedataend") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(30,5); + childData = child.data; + + assertEquals("characterdataDeleteDataEndAssert","1230 North Ave. Dallas, Texas ",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataend</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html new file mode 100644 index 0000000000..512d227241 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedataexceedslength.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataexceedslength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedataexceedslength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedataexceedslength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the sum of the offset and count used in the + "deleteData(offset,count) method is greater than the + length of the character data then all the characters + from the offset to the end of the data are deleted. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=4 and count=50. + The method should delete the characters from position 4 + to the end of the data since the offset+count(50+4) + is greater than the length of the character data(35). + The new value of the character data should be "1230". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdatadeletedataexceedslength() { + var success; + if(checkInitialization(builder, "characterdatadeletedataexceedslength") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(4,50); + childData = child.data; + + assertEquals("characterdataDeleteDataExceedsLengthAssert","1230",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataexceedslength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html new file mode 100644 index 0000000000..ceaf5cd174 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatagetlengthanddata.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatagetlengthanddata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedatagetlengthanddata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedatagetlengthanddata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + On successful invocation of the "deleteData(offset,count)" + method, the "getData()" and "getLength()" methods reflect + the changes. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=30 and count=5. + The method should delete the characters from position + 30 thru position 35. The new value of the character data + should be "1230 North Ave. Dallas, Texas" which is + returned by the "getData()" method and "getLength()" + method should return 30". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdatadeletedatagetlengthanddata() { + var success; + if(checkInitialization(builder, "characterdatadeletedatagetlengthanddata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + var childLength; + var result = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(30,5); + childData = child.data; + + assertEquals("data","1230 North Ave. Dallas, Texas ",childData); + childLength = child.length; + + assertEquals("length",30,childLength); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatagetlengthanddata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html new file mode 100644 index 0000000000..7e19ee0dbd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatamiddle.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatamiddle</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedatamiddle']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedatamiddle'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method removes a range of + characters from the node. Delete data in the middle + of the character data. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=16 and count=8. + The method should delete the characters from position + 16 thru position 24. The new value of the character data + should be "1230 North Ave. Texas 98551". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdatadeletedatamiddle() { + var success; + if(checkInitialization(builder, "characterdatadeletedatamiddle") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(16,8); + childData = child.data; + + assertEquals("characterdataDeleteDataMiddleAssert","1230 North Ave. Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatamiddle</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html new file mode 100644 index 0000000000..e03b42cae9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederr.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedatanomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedatanomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises a NO_MODIFICATION_ALLOWED_ERR + DOMException if the node is readonly. + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "deleteData(offset,count)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdatadeletedatanomodificationallowederr() { + var success; + if(checkInitialization(builder, "characterdatadeletedatanomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entElement; + var entElementContent; + var nodeType; + var entReference; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = genderNode.firstChild; + + assertNotNull("entReferenceNotNull",entReference); +nodeType = entReference.nodeType; + + + if( + (3 == nodeType) + ) { + entReference = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entReference); + + } + entElement = entReference.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementContent = entElement.firstChild; + + assertNotNull("entElementContentNotNull",entElementContent); + + { + success = false; + try { + entElementContent.deleteData(1,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html new file mode 100644 index 0000000000..5a0b28e1a6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatadeletedatanomodificationallowederrEE.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatadeletedatanomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatadeletedatanomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Create an ent3 entity reference and call deleteData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr.xml +*/ +function characterdatadeletedatanomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "characterdatadeletedatanomodificationallowederrEE") != null) return; + var doc; + var genderList; + var genderNode; + var entText; + var entReference; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entReference); +appendedChild = genderNode.appendChild(entReference); + entText = entReference.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + entText.deleteData(1,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html new file mode 100644 index 0000000000..a5dea6d1a1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatagetdata.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatagetdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatagetdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getData()" method retrieves the character data + + currently stored in the node. + + Retrieve the character data from the second child + + of the first employee and invoke the "getData()" + + method. The method returns the character data + + string. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +*/ +function characterdatagetdata() { + var success; + if(checkInitialization(builder, "characterdatagetdata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + childData = child.data; + + assertEquals("characterdataGetDataAssert","Margaret Martin",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html b/dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html new file mode 100644 index 0000000000..2a4cf77b9d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatagetlength.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetlength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatagetlength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatagetlength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of characters + stored in this nodes data. + Retrieve the character data from the second + child of the first employee and examine the + value returned by the getLength() method. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C +*/ +function characterdatagetlength() { + var success; + if(checkInitialization(builder, "characterdatagetlength") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childValue; + var childLength; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + childValue = child.data; + + childLength = childValue.length; + assertEquals("characterdataGetLengthAssert",15,childLength); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetlength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html new file mode 100644 index 0000000000..1004271afa --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedatacountnegative.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedatacountnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrdeletedatacountnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrdeletedatacountnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified count + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "deleteData(offset,count)" + method with offset=10 and count=-3. It should raise the + desired exception since the count is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function characterdataindexsizeerrdeletedatacountnegative() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrdeletedatacountnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(10,-3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedatacountnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html new file mode 100644 index 0000000000..ea6d9f2ca6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetgreater.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrdeletedataoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrdeletedataoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater that the number of characters in the string. + + Retrieve the character data of the last child of the + first employee and invoke its "deleteData(offset,count)" + method with offset=40 and count=3. It should raise the + desired exception since the offset is greater than the + number of characters in the string. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function characterdataindexsizeerrdeletedataoffsetgreater() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrdeletedataoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(40,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html new file mode 100644 index 0000000000..a624539aa1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrdeletedataoffsetnegative.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrdeletedataoffsetnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrdeletedataoffsetnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "deleteData(offset,count)" + method with offset=-5 and count=3. It should raise the + desired exception since the offset is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function characterdataindexsizeerrdeletedataoffsetnegative() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrdeletedataoffsetnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(-5,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html new file mode 100644 index 0000000000..e7c3e498e4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetgreater.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrinsertdataoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrinsertdataoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater than the number of characters in the string. + + Retrieve the character data of the last child of the + first employee and invoke its insertData"(offset,arg)" + method with offset=40 and arg="ABC". It should raise + the desired exception since the offset is greater than + the number of characters in the string. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function characterdataindexsizeerrinsertdataoffsetgreater() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrinsertdataoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.insertData(40,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html new file mode 100644 index 0000000000..07629d8cff --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrinsertdataoffsetnegative.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrinsertdataoffsetnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrinsertdataoffsetnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its insertData"(offset,arg)" + method with offset=-5 and arg="ABC". It should raise + the desired exception since the offset is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function characterdataindexsizeerrinsertdataoffsetnegative() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrinsertdataoffsetnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.insertData(-5,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html new file mode 100644 index 0000000000..33596a89c4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedatacountnegative.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedatacountnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrreplacedatacountnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrreplacedatacountnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified count + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its + "replaceData(offset,count,arg) method with offset=10 + and count=-3 and arg="ABC". It should raise the + desired exception since the count is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function characterdataindexsizeerrreplacedatacountnegative() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrreplacedatacountnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.replaceData(10,-3,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedatacountnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html new file mode 100644 index 0000000000..f0d68a2375 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetgreater.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrreplacedataoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrreplacedataoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater than the length of the string. + + Retrieve the character data of the last child of the + first employee and invoke its + "replaceData(offset,count,arg) method with offset=40 + and count=3 and arg="ABC". It should raise the + desired exception since the offset is greater than the + length of the string. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function characterdataindexsizeerrreplacedataoffsetgreater() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrreplacedataoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.replaceData(40,3,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html new file mode 100644 index 0000000000..939ca80f4d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrreplacedataoffsetnegative.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrreplacedataoffsetnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrreplacedataoffsetnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its + "replaceData(offset,count,arg) method with offset=-5 + and count=3 and arg="ABC". It should raise the + desired exception since the offset is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdataindexsizeerrreplacedataoffsetnegative() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrreplacedataoffsetnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.replaceData(-5,3,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html new file mode 100644 index 0000000000..68750b9e63 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringcountnegative.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringcountnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrsubstringcountnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrsubstringcountnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified count + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "substringData(offset,count) + method with offset=10 and count=-3. It should raise the + desired exception since the count is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function characterdataindexsizeerrsubstringcountnegative() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrsubstringcountnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badSubstring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badSubstring = child.substringData(10,-3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringcountnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html new file mode 100644 index 0000000000..2a724d22ab --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringnegativeoffset.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringnegativeoffset</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrsubstringnegativeoffset']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrsubstringnegativeoffset'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "substringData(offset,count) + method with offset=-5 and count=3. It should raise the + desired exception since the offset is negative. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function characterdataindexsizeerrsubstringnegativeoffset() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrsubstringnegativeoffset") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badString; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badString = child.substringData(-5,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringnegativeoffset</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html new file mode 100644 index 0000000000..569cf6ac10 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdataindexsizeerrsubstringoffsetgreater.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdataindexsizeerrsubstringoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdataindexsizeerrsubstringoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater than the number of characters in the string. + + Retrieve the character data of the last child of the + first employee and invoke its "substringData(offset,count) + method with offset=40 and count=3. It should raise the + desired exception since the offsets value is greater + than the length. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function characterdataindexsizeerrsubstringoffsetgreater() { + var success; + if(checkInitialization(builder, "characterdataindexsizeerrsubstringoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badString; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badString = child.substringData(40,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html new file mode 100644 index 0000000000..049a94e6ea --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatabeginning.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatabeginning</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatainsertdatabeginning']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatainsertdatabeginning'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "insertData(offset,arg)" method will insert a string +at the specified character offset. Insert the data at +the beginning of the character data. + +Retrieve the character data from the second child of +the first employee. The "insertData(offset,arg)" +method is then called with offset=0 and arg="Mss.". +The method should insert the string "Mss." at position 0. +The new value of the character data should be +"Mss. Margaret Martin". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function characterdatainsertdatabeginning() { + var success; + if(checkInitialization(builder, "characterdatainsertdatabeginning") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.insertData(0,"Mss. "); + childData = child.data; + + assertEquals("characterdataInsertDataBeginningAssert","Mss. Margaret Martin",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatabeginning</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html new file mode 100644 index 0000000000..a6ba22ddf5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdataend.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdataend</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatainsertdataend']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatainsertdataend'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method will insert a string + at the specified character offset. Insert the data at + the end of the character data. + + Retrieve the character data from the second child of + the first employee. The "insertData(offset,arg)" + method is then called with offset=15 and arg=", Esquire". + The method should insert the string ", Esquire" at + position 15. The new value of the character data should + be "Margaret Martin, Esquire". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function characterdatainsertdataend() { + var success; + if(checkInitialization(builder, "characterdatainsertdataend") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.insertData(15,", Esquire"); + childData = child.data; + + assertEquals("characterdataInsertDataEndAssert","Margaret Martin, Esquire",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdataend</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html new file mode 100644 index 0000000000..ec056627eb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatamiddle.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatamiddle</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatainsertdatamiddle']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatainsertdatamiddle'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method will insert a string + at the specified character offset. Insert the data in + the middle of the character data. + + Retrieve the character data from the second child of + the first employee. The "insertData(offset,arg)" + method is then called with offset=9 and arg="Ann". + The method should insert the string "Ann" at position 9. + The new value of the character data should be + "Margaret Ann Martin". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function characterdatainsertdatamiddle() { + var success; + if(checkInitialization(builder, "characterdatainsertdatamiddle") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.insertData(9,"Ann "); + childData = child.data; + + assertEquals("characterdataInsertDataMiddleAssert","Margaret Ann Martin",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatamiddle</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html new file mode 100644 index 0000000000..63d9d0aa2c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederr.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatainsertdatanomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatainsertdatanomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method raises a NO_MODIFICATION_ALLOWED_ERR + DOMException if the node is readonly. + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "insertData(offset,arg)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function characterdatainsertdatanomodificationallowederr() { + var success; + if(checkInitialization(builder, "characterdatainsertdatanomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entElement; + var nodeType; + var entElementContent; + var entReference; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = genderNode.firstChild; + + assertNotNull("entReferenceNotNull",entReference); +nodeType = entReference.nodeType; + + + if( + (1 == nodeType) + ) { + entReference = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entReference); + + } + entElement = entReference.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementContent = entElement.firstChild; + + assertNotNull("entElementContentNotNull",entElementContent); + + { + success = false; + try { + entElementContent.insertData(1,"newArg"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html new file mode 100644 index 0000000000..6a17addf4b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatainsertdatanomodificationallowederrEE.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatainsertdatanomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatainsertdatanomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Create an ent3 entity reference and call insertData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr.xml +*/ +function characterdatainsertdatanomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "characterdatainsertdatanomodificationallowederrEE") != null) return; + var doc; + var genderList; + var genderNode; + var entText; + var entReference; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entReference); +entText = entReference.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + entText.insertData(1,"newArg"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html new file mode 100644 index 0000000000..c1b61606e9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatabegining.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatabegining</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedatabegining']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedatabegining'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "replaceData(offset,count,arg)" method replaces the +characters starting at the specified offset with the +specified string. Test for replacement in the +middle of the data. + +Retrieve the character data from the last child of the +first employee. The "replaceData(offset,count,arg)" +method is then called with offset=5 and count=5 and +arg="South". The method should replace characters five +thru 9 of the character data with "South". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdatareplacedatabegining() { + var success; + if(checkInitialization(builder, "characterdatareplacedatabegining") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(0,4,"2500"); + childData = child.data; + + assertEquals("characterdataReplaceDataBeginingAssert","2500 North Ave. Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatabegining</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html new file mode 100644 index 0000000000..ea6829218d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataend.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataend</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedataend']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedataend'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method replaces the + characters starting at the specified offset with the + specified string. Test for replacement at the + end of the data. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=30 and count=5 and + arg="98665". The method should replace characters 30 + thru 34 of the character data with "98665". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdatareplacedataend() { + var success; + if(checkInitialization(builder, "characterdatareplacedataend") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(30,5,"98665"); + childData = child.data; + + assertEquals("characterdataReplaceDataEndAssert","1230 North Ave. Dallas, Texas 98665",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataend</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html new file mode 100644 index 0000000000..3fb9a72a2d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofarg.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofarg</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedataexceedslengthofarg']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedataexceedslengthofarg'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method replaces the + characters starting at the specified offset with the + specified string. Test the situation where the length + of the arg string is greater than the specified offset. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=0 and count=4 and + arg="260030". The method should replace characters one + thru four with "260030". Note that the length of the + specified string is greater that the specified offset. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdatareplacedataexceedslengthofarg() { + var success; + if(checkInitialization(builder, "characterdatareplacedataexceedslengthofarg") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(0,4,"260030"); + childData = child.data; + + assertEquals("characterdataReplaceDataExceedsLengthOfArgAssert","260030 North Ave. Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofarg</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html new file mode 100644 index 0000000000..94e5a8053a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedataexceedslengthofdata.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedataexceedslengthofdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedataexceedslengthofdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the sum of the offset and count exceeds the length then + all the characters to the end of the data are replaced. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=0 and count=50 and + arg="2600". The method should replace all the characters + with "2600". This is because the sum of the offset and + count exceeds the length of the character data. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdatareplacedataexceedslengthofdata() { + var success; + if(checkInitialization(builder, "characterdatareplacedataexceedslengthofdata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(0,50,"2600"); + childData = child.data; + + assertEquals("characterdataReplaceDataExceedsLengthOfDataAssert","2600",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html new file mode 100644 index 0000000000..3f65f14f77 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatamiddle.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatamiddle</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedatamiddle']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedatamiddle'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method replaces the + characters starting at the specified offset with the + specified string. Test for replacement in the + middle of the data. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=5 and count=5 and + arg="South". The method should replace characters five + thru 9 of the character data with "South". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdatareplacedatamiddle() { + var success; + if(checkInitialization(builder, "characterdatareplacedatamiddle") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(5,5,"South"); + childData = child.data; + + assertEquals("characterdataReplaceDataMiddleAssert","1230 South Ave. Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatamiddle</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html new file mode 100644 index 0000000000..fd624c6b16 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederr.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedatanomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedatanomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises a NO_MODIFICATION_ALLOWED_ERR + DOMException if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "replaceData(offset,count,arg)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function characterdatareplacedatanomodificationallowederr() { + var success; + if(checkInitialization(builder, "characterdatareplacedatanomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entElement; + var entElementContent; + var entReference; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = genderNode.firstChild; + + assertNotNull("entReferenceNotNull",entReference); +nodeType = entReference.nodeType; + + + if( + (1 == nodeType) + ) { + entReference = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entReference); + + } + entElement = entReference.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementContent = entElement.firstChild; + + assertNotNull("entElementContentNotNull",entElementContent); + + { + success = false; + try { + entElementContent.replaceData(1,3,"newArg"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html new file mode 100644 index 0000000000..0ef63da7c6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatareplacedatanomodificationallowederrEE.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatareplacedatanomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatareplacedatanomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Create an ent3 entity reference and call replaceData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr.xml +*/ +function characterdatareplacedatanomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "characterdatareplacedatanomodificationallowederrEE") != null) return; + var doc; + var genderList; + var genderNode; + var entText; + var entReference; + var appendedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entReference); +appendedNode = genderNode.appendChild(entReference); + entText = entReference.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + entText.replaceData(1,3,"newArg"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html new file mode 100644 index 0000000000..7b346ce4e1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederr.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatasetdatanomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatasetdatanomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setData(data)" method raises a NO_MODIFICATION_ALLOWED_ERR + DOMException if the node is readonly. + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "setData(data)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +*/ +function characterdatasetdatanomodificationallowederr() { + var success; + if(checkInitialization(builder, "characterdatasetdatanomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entElement; + var entElementContent; + var entReference; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entReference = genderNode.firstChild; + + assertNotNull("entReferenceNotNull",entReference); +nodeType = entReference.nodeType; + + + if( + (1 == nodeType) + ) { + entReference = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entReference); + + } + entElement = entReference.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementContent = entElement.firstChild; + + assertNotNull("entElementContentNotNull",entElementContent); + + { + success = false; + try { + entElementContent.data = "newData"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html new file mode 100644 index 0000000000..c9278bc8be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasetdatanomodificationallowederrEE.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatasetdatanomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatasetdatanomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Create an ent3 entity reference and call setData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr.xml +*/ +function characterdatasetdatanomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "characterdatasetdatanomodificationallowederrEE") != null) return; + var doc; + var genderList; + var genderNode; + var entText; + var entReference; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(4); + entReference = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entReference); +entText = entReference.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + entText.data = "newData"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html new file mode 100644 index 0000000000..d69eacf107 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasetnodevalue.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatasetnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatasetnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNodeValue()" method changes the character data + currently stored in the node. + Retrieve the character data from the second child + of the first employee and invoke the "setNodeValue()" + method, call "getData()" and compare. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +*/ +function characterdatasetnodevalue() { + var success; + if(checkInitialization(builder, "characterdatasetnodevalue") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.nodeValue = "Marilyn Martin"; + + childData = child.data; + + assertEquals("data","Marilyn Martin",childData); + childValue = child.nodeValue; + + assertEquals("value","Marilyn Martin",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html new file mode 100644 index 0000000000..1cb5221b6c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringexceedsvalue.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringexceedsvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatasubstringexceedsvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatasubstringexceedsvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the sum of the "offset" and "count" exceeds the + "length" then the "substringData(offset,count)" method + returns all the characters to the end of the data. + + Retrieve the character data from the second child + of the first employee and access part of the data + by using the substringData(offset,count) method + with offset=9 and count=10. The method should return + the substring "Martin" since offset+count > length + (19 > 15). + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +*/ +function characterdatasubstringexceedsvalue() { + var success; + if(checkInitialization(builder, "characterdatasubstringexceedsvalue") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var substring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + substring = child.substringData(9,10); + assertEquals("characterdataSubStringExceedsValueAssert","Martin",substring); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringexceedsvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html new file mode 100644 index 0000000000..dc4aa78aed --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_characterdatasubstringvalue.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['characterdatasubstringvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'characterdatasubstringvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method returns the + specified string. + + Retrieve the character data from the second child + of the first employee and access part of the data + by using the substringData(offset,count) method. The + method should return the specified substring starting + at position "offset" and extract "count" characters. + The method should return the string "Margaret". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +*/ +function characterdatasubstringvalue() { + var success; + if(checkInitialization(builder, "characterdatasubstringvalue") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var substring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + substring = child.substringData(0,8); + assertEquals("characterdataSubStringValueAssert","Margaret",substring); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html b/dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html new file mode 100644 index 0000000000..6f7f921da6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_commentgetcomment.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/commentgetcomment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['commentgetcomment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'commentgetcomment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + A comment is all the characters between the starting + '<!--' and ending '-->' + Retrieve the nodes of the DOM document. Search for a + comment node and the content is its value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function commentgetcomment() { + var success; + if(checkInitialization(builder, "commentgetcomment") != null) return; + var doc; + var elementList; + var child; + var childName; + var childValue; + var commentCount = 0; + var childType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.childNodes; + + for(var indexN65623 = 0;indexN65623 < elementList.length; indexN65623++) { + child = elementList.item(indexN65623); + childType = child.nodeType; + + + if( + (8 == childType) + ) { + childName = child.nodeName; + + assertEquals("nodeName","#comment",childName); + childValue = child.nodeValue; + + assertEquals("nodeValue"," This is comment number 1.",childValue); + commentCount = commentCount + 1; + + } + + } + assertEquals("commentCount",1,commentCount); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/commentgetcomment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html new file mode 100644 index 0000000000..ff57a99114 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateattribute.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createAttribute(name)" method creates an Attribute + node of the given name. + + Retrieve the entire DOM document and invoke its + "createAttribute(name)" method. It should create a + new Attribute node with the given name. The name, value + and type of the newly created object are retrieved and + output. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +*/ +function documentcreateattribute() { + var success; + if(checkInitialization(builder, "documentcreateattribute") != null) return; + var doc; + var newAttrNode; + var attrValue; + var attrName; + var attrType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newAttrNode = doc.createAttribute("district"); + attrValue = newAttrNode.nodeValue; + + assertEquals("value","",attrValue); + attrName = newAttrNode.nodeName; + + assertEquals("name","district",attrName); + attrType = newAttrNode.nodeType; + + assertEquals("type",2,attrType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html new file mode 100644 index 0000000000..b7e50cfad2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatecdatasection.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecdatasection</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreatecdatasection']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreatecdatasection'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createCDATASection(data)" method creates a new + CDATASection node whose value is the specified string. + Retrieve the entire DOM document and invoke its + "createCDATASection(data)" method. It should create a + new CDATASection node whose "data" is the specified + string. The content, name and type are retrieved and + output. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D26C0AF8 +*/ +function documentcreatecdatasection() { + var success; + if(checkInitialization(builder, "documentcreatecdatasection") != null) return; + var doc; + var newCDATASectionNode; + var newCDATASectionValue; + var newCDATASectionName; + var newCDATASectionType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newCDATASectionNode = doc.createCDATASection("This is a new CDATASection node"); + newCDATASectionValue = newCDATASectionNode.nodeValue; + + assertEquals("nodeValue","This is a new CDATASection node",newCDATASectionValue); + newCDATASectionName = newCDATASectionNode.nodeName; + + assertEquals("nodeName","#cdata-section",newCDATASectionName); + newCDATASectionType = newCDATASectionNode.nodeType; + + assertEquals("nodeType",4,newCDATASectionType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecdatasection</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html new file mode 100644 index 0000000000..d448578d46 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatecomment.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecomment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreatecomment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreatecomment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createComment(data)" method creates a new Comment + node given the specified string. + Retrieve the entire DOM document and invoke its + "createComment(data)" method. It should create a new + Comment node whose "data" is the specified string. + The content, name and type are retrieved and output. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 +*/ +function documentcreatecomment() { + var success; + if(checkInitialization(builder, "documentcreatecomment") != null) return; + var doc; + var newCommentNode; + var newCommentValue; + var newCommentName; + var newCommentType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newCommentNode = doc.createComment("This is a new Comment node"); + newCommentValue = newCommentNode.nodeValue; + + assertEquals("value","This is a new Comment node",newCommentValue); + newCommentName = newCommentNode.nodeName; + + assertEquals("name","#comment",newCommentName); + newCommentType = newCommentNode.nodeType; + + assertEquals("type",8,newCommentType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecomment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html new file mode 100644 index 0000000000..ff47fab9c5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatedocumentfragment.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatedocumentfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreatedocumentfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreatedocumentfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createDocumentFragment()" method creates an empty + DocumentFragment object. + Retrieve the entire DOM document and invoke its + "createDocumentFragment()" method. The content, name, + type and value of the newly created object are output. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 +*/ +function documentcreatedocumentfragment() { + var success; + if(checkInitialization(builder, "documentcreatedocumentfragment") != null) return; + var doc; + var newDocFragment; + var children; + var length; + var newDocFragmentName; + var newDocFragmentType; + var newDocFragmentValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newDocFragment = doc.createDocumentFragment(); + children = newDocFragment.childNodes; + + length = children.length; + + assertEquals("length",0,length); + newDocFragmentName = newDocFragment.nodeName; + + assertEquals("name","#document-fragment",newDocFragmentName); + newDocFragmentType = newDocFragment.nodeType; + + assertEquals("type",11,newDocFragmentType); + newDocFragmentValue = newDocFragment.nodeValue; + + assertNull("value",newDocFragmentValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatedocumentfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html new file mode 100644 index 0000000000..a81513c152 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateelement.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelement</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelement']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelement'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createElement(tagName)" method creates an Element + of the type specified. + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method with tagName="address". + The method should create an instance of an Element node + whose tagName is "address". The NodeName, NodeType + and NodeValue are returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +*/ +function documentcreateelement() { + var success; + if(checkInitialization(builder, "documentcreateelement") != null) return; + var doc; + var newElement; + var newElementName; + var newElementType; + var newElementValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newElement = doc.createElement("address"); + newElementName = newElement.nodeName; + + assertEquals("name","address",newElementName); + newElementType = newElement.nodeType; + + assertEquals("type",1,newElementType); + newElementValue = newElement.nodeValue; + + assertNull("valueInitiallyNull",newElementValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelement</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html new file mode 100644 index 0000000000..a609bc6140 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementcasesensitive.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementcasesensitive</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelementcasesensitive']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelementcasesensitive'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The tagName parameter in the "createElement(tagName)" + method is case-sensitive for XML documents. + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method twice. Once for tagName + equal to "address" and once for tagName equal to "ADDRESS" + Each call should create a distinct Element node. The + newly created Elements are then assigned attributes + that are retrieved. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +*/ +function documentcreateelementcasesensitive() { + var success; + if(checkInitialization(builder, "documentcreateelementcasesensitive") != null) return; + var doc; + var newElement1; + var newElement2; + var attribute1; + var attribute2; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newElement1 = doc.createElement("ADDRESS"); + newElement2 = doc.createElement("address"); + newElement1.setAttribute("district","Fort Worth"); + newElement2.setAttribute("county","Dallas"); + attribute1 = newElement1.getAttribute("district"); + attribute2 = newElement2.getAttribute("county"); + assertEquals("attrib1","Fort Worth",attribute1); + assertEquals("attrib2","Dallas",attribute2); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementcasesensitive</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html new file mode 100644 index 0000000000..bd7bb0f8db --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateelementdefaultattr.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementdefaultattr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelementdefaultattr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelementdefaultattr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createElement(tagName)" method creates an Element + of the type specified. In addition, if there are known attributes + with default values, Attr nodes representing them are automatically + created and attached to the element. + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method with tagName="address". + The method should create an instance of an Element node + whose tagName is "address". The tagName "address" has an + attribute with default values, therefore the newly created element + will have them. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function documentcreateelementdefaultattr() { + var success; + if(checkInitialization(builder, "documentcreateelementdefaultattr") != null) return; + var doc; + var newElement; + var defaultAttr; + var child; + var name; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newElement = doc.createElement("address"); + defaultAttr = newElement.attributes; + + child = defaultAttr.item(0); + assertNotNull("defaultAttrNotNull",child); +name = child.nodeName; + + assertEquals("attrName","street",name); + value = child.nodeValue; + + assertEquals("attrValue","Yes",value); + assertSize("attrCount",1,defaultAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementdefaultattr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html new file mode 100644 index 0000000000..200644f6aa --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreference.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreference</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateentityreference']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateentityreference'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createEntityReference(name)" method creates an + EntityReferrence node. + + Retrieve the entire DOM document and invoke its + "createEntityReference(name)" method. It should create + a new EntityReference node for the Entity with the + given name. The name, value and type are retrieved and + output. + +* @author NIST +* @author Mary Brady +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function documentcreateentityreference() { + var success; + if(checkInitialization(builder, "documentcreateentityreference") != null) return; + var doc; + var newEntRefNode; + var entRefValue; + var entRefName; + var entRefType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newEntRefNode = doc.createEntityReference("ent1"); + assertNotNull("createdEntRefNotNull",newEntRefNode); +entRefValue = newEntRefNode.nodeValue; + + assertNull("value",entRefValue); + entRefName = newEntRefNode.nodeName; + + assertEquals("name","ent1",entRefName); + entRefType = newEntRefNode.nodeType; + + assertEquals("type",5,entRefType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreference</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html new file mode 100644 index 0000000000..c854b5c766 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateentityreferenceknown.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreferenceknown</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateentityreferenceknown']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateentityreferenceknown'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createEntityReference(name)" method creates an + EntityReference node. In addition, if the referenced entity + is known, the child list of the "EntityReference" node + is the same as the corresponding "Entity" node. + + Retrieve the entire DOM document and invoke its + "createEntityReference(name)" method. It should create + a new EntityReference node for the Entity with the + given name. The referenced entity is known, therefore the child + list of the "EntityReference" node is the same as the corresponding + "Entity" node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE +*/ +function documentcreateentityreferenceknown() { + var success; + if(checkInitialization(builder, "documentcreateentityreferenceknown") != null) return; + var doc; + var newEntRefNode; + var newEntRefList; + var child; + var name; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newEntRefNode = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",newEntRefNode); +newEntRefList = newEntRefNode.childNodes; + + assertSize("size",1,newEntRefList); +child = newEntRefNode.firstChild; + + name = child.nodeName; + + assertEquals("name","#text",name); + value = child.nodeValue; + + assertEquals("value","Texas",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreferenceknown</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html b/dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html new file mode 100644 index 0000000000..4b461ed877 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreateprocessinginstruction.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateprocessinginstruction</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateprocessinginstruction']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateprocessinginstruction'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createProcessingInstruction(target,data)" method + creates a new ProcessingInstruction node with the + specified name and data string. + + Retrieve the entire DOM document and invoke its + "createProcessingInstruction(target,data)" method. + It should create a new PI node with the specified target + and data. The target, data and type are retrieved and + output. + +* @author NIST +* @author Mary Brady +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core# +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0020.html +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function documentcreateprocessinginstruction() { + var success; + if(checkInitialization(builder, "documentcreateprocessinginstruction") != null) return; + var doc; + var newPINode; + var piValue; + var piName; + var piType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newPINode = doc.createProcessingInstruction("TESTPI","This is a new PI node"); + assertNotNull("createdPINotNull",newPINode); +piName = newPINode.nodeName; + + assertEquals("name","TESTPI",piName); + piValue = newPINode.nodeValue; + + assertEquals("value","This is a new PI node",piValue); + piType = newPINode.nodeType; + + assertEquals("type",7,piType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateprocessinginstruction</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html new file mode 100644 index 0000000000..e369135a59 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentcreatetextnode.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatetextnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreatetextnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreatetextnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createTextNode(data)" method creates a Text node + given the specfied string. + Retrieve the entire DOM document and invoke its + "createTextNode(data)" method. It should create a + new Text node whose "data" is the specified string. + The NodeName and NodeType are also checked. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127 +*/ +function documentcreatetextnode() { + var success; + if(checkInitialization(builder, "documentcreatetextnode") != null) return; + var doc; + var newTextNode; + var newTextName; + var newTextValue; + var newTextType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newTextNode = doc.createTextNode("This is a new Text node"); + newTextValue = newTextNode.nodeValue; + + assertEquals("value","This is a new Text node",newTextValue); + newTextName = newTextNode.nodeName; + + assertEquals("name","#text",newTextName); + newTextType = newTextNode.nodeType; + + assertEquals("type",3,newTextType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatetextnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html new file mode 100644 index 0000000000..a4bc82a818 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctype.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetdoctype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetdoctype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getDoctype()" method returns the Document + Type Declaration associated with this document. + Retrieve the entire DOM document and invoke its + "getDoctype()" method. The name of the document + type should be returned. The "getName()" method + should be equal to "staff" or "svg". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function documentgetdoctype() { + var success; + if(checkInitialization(builder, "documentgetdoctype") != null) return; + var doc; + var docType; + var docTypeName; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +docTypeName = docType.name; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("doctypeNameSVG","svg",docTypeName); + + } + + else { + assertEquals("doctypeName","staff",docTypeName); + + } + nodeValue = docType.nodeValue; + + assertNull("initiallyNull",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html new file mode 100644 index 0000000000..f02b6dfdbf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetdoctypenodtd.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetdoctypenodtd']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_nodtdstaff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetdoctypenodtd'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getDoctype()" method returns null for XML documents + without a document type declaration. + Retrieve the XML document without a DTD and invoke the + "getDoctype()" method. It should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 +*/ +function documentgetdoctypenodtd() { + var success; + if(checkInitialization(builder, "documentgetdoctypenodtd") != null) return; + var doc; + var docType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_nodtdstaff"); + docType = doc.doctype; + + assertNull("documentGetDocTypeNoDTDAssert",docType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_nodtdstaff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html new file mode 100644 index 0000000000..4fa670435d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamelength.html @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamelength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnamelength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnamelength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getElementsByTagName(tagName)" method returns a + NodeList of all the Elements with a given tagName. + + Retrieve the entire DOM document and invoke its + "getElementsByTagName(tagName)" method with tagName + equal to "name". The method should return a NodeList + that contains 5 elements. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 +*/ +function documentgetelementsbytagnamelength() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnamelength") != null) return; + var doc; + var nameList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + nameList = doc.getElementsByTagName("name"); + assertSize("documentGetElementsByTagNameLengthAssert",5,nameList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamelength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html new file mode 100644 index 0000000000..e06cf3adcd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnametotallength.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnametotallength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnametotallength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnametotallength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the entire DOM document, invoke + getElementsByTagName("*") and check the length of the NodeList. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 +*/ +function documentgetelementsbytagnametotallength() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnametotallength") != null) return; + var doc; + var nameList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + nameList = doc.getElementsByTagName("*"); + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertSize("elementCountSVG",39,nameList); + + } + + else { + assertSize("documentGetElementsByTagNameTotalLengthAssert",37,nameList); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnametotallength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html new file mode 100644 index 0000000000..bb85caac68 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetelementsbytagnamevalue.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnamevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnamevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getElementsByTagName(tagName)" method returns a + NodeList of all the Elements with a given tagName + in a pre-order traversal of the tree. + + Retrieve the entire DOM document and invoke its + "getElementsByTagName(tagName)" method with tagName + equal to "name". The method should return a NodeList + that contains 5 elements. The FOURTH item in the + list is retrieved and output. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 +*/ +function documentgetelementsbytagnamevalue() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnamevalue") != null) return; + var doc; + var nameList; + var nameNode; + var firstChild; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + nameList = doc.getElementsByTagName("name"); + nameNode = nameList.item(3); + firstChild = nameNode.firstChild; + + childValue = firstChild.nodeValue; + + assertEquals("documentGetElementsByTagNameValueAssert","Jeny Oconnor",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html b/dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html new file mode 100644 index 0000000000..8c4b52d729 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetimplementation.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetimplementation</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetimplementation']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetimplementation'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getImplementation()" method returns the + DOMImplementation object that handles this document. + Retrieve the entire DOM document and invoke its + "getImplementation()" method. It should return a + DOMImplementation whose "hasFeature("XML","1.0") + method returns the boolean value "true". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA +*/ +function documentgetimplementation() { + var success; + if(checkInitialization(builder, "documentgetimplementation") != null) return; + var doc; + var docImpl; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docImpl = doc.implementation; +state = docImpl.hasFeature("XML","1.0"); +assertTrue("documentGetImplementationAssert",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetimplementation</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html b/dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html new file mode 100644 index 0000000000..b57042018f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentgetrootnode.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetrootnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetrootnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetrootnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getDocumentElement()" method provides direct access + to the child node that is the root element of the document. + Retrieve the entire DOM document and invoke its + "getDocumentElement()" method. It should return an + Element node whose NodeName is "staff" (or "svg"). + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function documentgetrootnode() { + var success; + if(checkInitialization(builder, "documentgetrootnode") != null) return; + var doc; + var root; + var rootName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + root = doc.documentElement; + + rootName = root.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgRootNode","svg",rootName); + + } + + else { + assertEquals("documentGetRootNodeAssert","staff",rootName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetrootnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html new file mode 100644 index 0000000000..312f7bf5d4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateattribute.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentinvalidcharacterexceptioncreateattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentinvalidcharacterexceptioncreateattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createAttribute(tagName)" method raises an + INVALID_CHARACTER_ERR DOMException if the specified + tagName contains an invalid character. + + Retrieve the entire DOM document and invoke its + "createAttribute(tagName)" method with the tagName equal + to the string "invalid^Name". Due to the invalid + character the desired EXCEPTION should be raised. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function documentinvalidcharacterexceptioncreateattribute() { + var success; + if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateattribute") != null) return; + var doc; + var createdAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + + { + success = false; + try { + createdAttr = doc.createAttribute("invalid^Name"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html new file mode 100644 index 0000000000..071f634832 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateelement.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateelement</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentinvalidcharacterexceptioncreateelement']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentinvalidcharacterexceptioncreateelement'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createElement(tagName)" method raises an + INVALID_CHARACTER_ERR DOMException if the specified + tagName contains an invalid character. + + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method with the tagName equal + to the string "invalid^Name". Due to the invalid + character the desired EXCEPTION should be raised. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function documentinvalidcharacterexceptioncreateelement() { + var success; + if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateelement") != null) return; + var doc; + var badElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + + { + success = false; + try { + badElement = doc.createElement("invalid^Name"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateelement</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html new file mode 100644 index 0000000000..47e1daca5b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref.html @@ -0,0 +1,159 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentinvalidcharacterexceptioncreateentref']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentinvalidcharacterexceptioncreateentref'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createEntityReference(tagName)" method raises an + INVALID_CHARACTER_ERR DOMException if the specified + tagName contains an invalid character. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function documentinvalidcharacterexceptioncreateentref() { + var success; + if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateentref") != null) return; + var doc; + var badEntityRef; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + badEntityRef = doc.createEntityReference("foo"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + + { + success = false; + try { + badEntityRef = doc.createEntityReference("invalid^Name"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html new file mode 100644 index 0000000000..ccebfd2cfc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreateentref1.html @@ -0,0 +1,156 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentinvalidcharacterexceptioncreateentref1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentinvalidcharacterexceptioncreateentref1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Creating an entity reference with an empty name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function documentinvalidcharacterexceptioncreateentref1() { + var success; + if(checkInitialization(builder, "documentinvalidcharacterexceptioncreateentref1") != null) return; + var doc; + var badEntityRef; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + badEntityRef = doc.createEntityReference("foo"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + + { + success = false; + try { + badEntityRef = doc.createEntityReference(""); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html new file mode 100644 index 0000000000..8be46b87e5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi.html @@ -0,0 +1,159 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentinvalidcharacterexceptioncreatepi']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentinvalidcharacterexceptioncreatepi'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createProcessingInstruction(target,data) method + raises an INVALID_CHARACTER_ERR DOMException if the + specified tagName contains an invalid character. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function documentinvalidcharacterexceptioncreatepi() { + var success; + if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi") != null) return; + var doc; + var badPI; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + badPI = doc.createProcessingInstruction("foo","data"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + + { + success = false; + try { + badPI = doc.createProcessingInstruction("invalid^Name","data"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html new file mode 100644 index 0000000000..9ef4fe3e09 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documentinvalidcharacterexceptioncreatepi1.html @@ -0,0 +1,156 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentinvalidcharacterexceptioncreatepi1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentinvalidcharacterexceptioncreatepi1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function documentinvalidcharacterexceptioncreatepi1() { + var success; + if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi1") != null) return; + var doc; + var badPI; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + badPI = doc.createProcessingInstruction("foo","data"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + + { + success = false; + try { + badPI = doc.createProcessingInstruction("","data"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html new file mode 100644 index 0000000000..ccb9aca95e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetdoctype.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetdoctype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypegetdoctype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypegetdoctype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getName()" method contains the name of the DTD. + + Retrieve the Document Type for this document and examine + the string returned by the "getName()" method. + It should be set to "staff". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1844763134 +*/ +function documenttypegetdoctype() { + var success; + if(checkInitialization(builder, "documenttypegetdoctype") != null) return; + var doc; + var docType; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +name = docType.name; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("doctypeName","svg",name); + + } + + else { + assertEquals("documenttypeGetDocTypeAssert","staff",name); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetdoctype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html new file mode 100644 index 0000000000..00de7950b5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentities.html @@ -0,0 +1,171 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentities</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypegetentities']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypegetentities'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getEntities()" method is a NamedNodeMap that contains + the general entities for this document. + + Retrieve the Document Type for this document and create + a NamedNodeMap of all its entities. The entire map is + traversed and the names of the entities are retrieved. + There should be 5 entities. Duplicates should be ignored. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 +*/ +function documenttypegetentities() { + var success; + if(checkInitialization(builder, "documenttypegetentities") != null) return; + var doc; + var docType; + var entityList; + var name; + expectedResult = new Array(); + expectedResult[0] = "ent1"; + expectedResult[1] = "ent2"; + expectedResult[2] = "ent3"; + expectedResult[3] = "ent4"; + expectedResult[4] = "ent5"; + + expectedResultSVG = new Array(); + expectedResultSVG[0] = "ent1"; + expectedResultSVG[1] = "ent2"; + expectedResultSVG[2] = "ent3"; + expectedResultSVG[3] = "ent4"; + expectedResultSVG[4] = "ent5"; + expectedResultSVG[5] = "svgunit"; + expectedResultSVG[6] = "svgtest"; + + var nameList = new Array(); + + var entity; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); +for(var indexN65659 = 0;indexN65659 < entityList.length; indexN65659++) { + entity = entityList.item(indexN65659); + name = entity.nodeName; + + nameList[nameList.length] = name; + + } + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEqualsCollection("entityNamesSVG",expectedResultSVG,nameList); + + } + + else { + assertEqualsCollection("entityNames",expectedResult,nameList); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentities</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html new file mode 100644 index 0000000000..88058e01d2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitieslength.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitieslength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypegetentitieslength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypegetentitieslength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Duplicate entities are to be discarded. + Retrieve the Document Type for this document and create + a NamedNodeMap of all its entities. The entity named + "ent1" is defined twice and therefore that last + occurrance should be discarded. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 +*/ +function documenttypegetentitieslength() { + var success; + if(checkInitialization(builder, "documenttypegetentitieslength") != null) return; + var doc; + var docType; + var entityList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertSize("entitySizeSVG",7,entityList); + + } + + else { + assertSize("entitySize",5,entityList); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitieslength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html new file mode 100644 index 0000000000..ecbc9ae142 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetentitiestype.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitiestype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypegetentitiestype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypegetentitiestype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Every node in the map returned by the "getEntities()" + method implements the Entity interface. + + Retrieve the Document Type for this document and create + a NamedNodeMap of all its entities. Traverse the + entire list and examine the NodeType of each node + in the list. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 +*/ +function documenttypegetentitiestype() { + var success; + if(checkInitialization(builder, "documenttypegetentitiestype") != null) return; + var doc; + var docType; + var entityList; + var entity; + var entityType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); +for(var indexN65609 = 0;indexN65609 < entityList.length; indexN65609++) { + entity = entityList.item(indexN65609); + entityType = entity.nodeType; + + assertEquals("documenttypeGetEntitiesTypeAssert",6,entityType); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitiestype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html new file mode 100644 index 0000000000..6c2819d377 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotations.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotations</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypegetnotations']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypegetnotations'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNotations()" method creates a NamedNodeMap that + contains all the notations declared in the DTD. + + Retrieve the Document Type for this document and create + a NamedNodeMap object of all the notations. There + should be two items in the list (notation1 and notation2). + +* @author NIST +* @author Mary Brady +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF +*/ +function documenttypegetnotations() { + var success; + if(checkInitialization(builder, "documenttypegetnotations") != null) return; + var doc; + var docType; + var notationList; + var notation; + var notationName; + var actual = new Array(); + + expected = new Array(); + expected[0] = "notation1"; + expected[1] = "notation2"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notationList = docType.notations; + + assertNotNull("notationsNotNull",notationList); +for(var indexN65627 = 0;indexN65627 < notationList.length; indexN65627++) { + notation = notationList.item(indexN65627); + notationName = notation.nodeName; + + actual[actual.length] = notationName; + + } + assertEqualsCollection("names",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotations</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html new file mode 100644 index 0000000000..6a467eb742 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_documenttypegetnotationstype.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotationstype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypegetnotationstype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypegetnotationstype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Every node in the map returned by the "getNotations()" + method implements the Notation interface. + + Retrieve the Document Type for this document and create + a NamedNodeMap object of all the notations. Traverse + the entire list and examine the NodeType of each node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF +*/ +function documenttypegetnotationstype() { + var success; + if(checkInitialization(builder, "documenttypegetnotationstype") != null) return; + var doc; + var docType; + var notationList; + var notation; + var notationType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notationList = docType.notations; + + assertNotNull("notationsNotNull",notationList); +for(var indexN65609 = 0;indexN65609 < notationList.length; indexN65609++) { + notation = notationList.item(indexN65609); + notationType = notation.nodeType; + + assertEquals("documenttypeGetNotationsTypeAssert",12,notationType); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotationstype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html new file mode 100644 index 0000000000..699e640344 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenoversion.html @@ -0,0 +1,122 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenoversion</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationfeaturenoversion']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationfeaturenoversion'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +hasFeature("XML", "") should return true for implementations that can read staff files. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 +* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 +*/ +function domimplementationfeaturenoversion() { + var success; + if(checkInitialization(builder, "domimplementationfeaturenoversion") != null) return; + var doc; + var domImpl; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + domImpl = doc.implementation; +state = domImpl.hasFeature("XML",""); +assertTrue("hasXMLEmpty",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenoversion</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html new file mode 100644 index 0000000000..b086fdd703 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturenull.html @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationfeaturenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("hasNullString", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationfeaturenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +hasFeature("XML", null) should return true for implementations that can read staff documents. + +* @author NIST +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 +* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 +*/ +function domimplementationfeaturenull() { + var success; + if(checkInitialization(builder, "domimplementationfeaturenull") != null) return; + var doc; + var domImpl; + var state; + var nullVersion = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + domImpl = doc.implementation; +state = domImpl.hasFeature("XML",nullVersion); +assertTrue("hasXMLnull",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html new file mode 100644 index 0000000000..b4a436565b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_domimplementationfeaturexml.html @@ -0,0 +1,121 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturexml</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationfeaturexml']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationfeaturexml'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +hasFeature("xml", "1.0") should return true for implementations that can read staff documents. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 +*/ +function domimplementationfeaturexml() { + var success; + if(checkInitialization(builder, "domimplementationfeaturexml") != null) return; + var doc; + var domImpl; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + domImpl = doc.implementation; +state = domImpl.hasFeature("xml","1.0"); +assertTrue("hasXML1",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturexml</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html new file mode 100644 index 0000000000..06eaedf79c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementaddnewattribute.html @@ -0,0 +1,131 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementaddnewattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementaddnewattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementaddnewattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method adds a new attribute + to the Element + + Retrieve the last child of the last employee, then + add an attribute to it by invoking the + "setAttribute(name,value)" method. It should create + a "name" attribute with an assigned value equal to + "value". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +*/ +function elementaddnewattribute() { + var success; + if(checkInitialization(builder, "elementaddnewattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(4); + testEmployee.setAttribute("district","dallas"); + attrValue = testEmployee.getAttribute("district"); + assertEquals("elementAddNewAttributeAssert","dallas",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementaddnewattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html new file mode 100644 index 0000000000..2382d8acfd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementassociatedattribute.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementassociatedattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementassociatedattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementassociatedattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Elements may have attributes associated with them. + + Retrieve the first attribute from the last child of + the first employee and invoke the "getSpecified()" + method. This test is only intended to show that + Elements can actually have attributes. This test uses + the "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function elementassociatedattribute() { + var success; + if(checkInitialization(builder, "elementassociatedattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var domesticAttr; + var specified; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(0); + attributes = testEmployee.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + specified = domesticAttr.specified; + + assertTrue("domesticSpecified",specified); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementassociatedattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html b/dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html new file mode 100644 index 0000000000..a09d357243 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementchangeattributevalue.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementchangeattributevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementchangeattributevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementchangeattributevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method adds a new attribute + to the Element. If the "name" is already present, then + its value should be changed to the new one that is in + the "value" parameter. + + Retrieve the last child of the fourth employee, then add + an attribute to it by invoking the + "setAttribute(name,value)" method. Since the name of the + used attribute("street") is already present in this + element, then its value should be changed to the new one + of the "value" parameter. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +*/ +function elementchangeattributevalue() { + var success; + if(checkInitialization(builder, "elementchangeattributevalue") != null) return; + var doc; + var elementList; + var testEmployee; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(3); + testEmployee.setAttribute("street","Neither"); + attrValue = testEmployee.getAttribute("street"); + assertEquals("elementChangeAttributeValueAssert","Neither",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementchangeattributevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html new file mode 100644 index 0000000000..f329f1aab0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementcreatenewattribute.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementcreatenewattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementcreatenewattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementcreatenewattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method adds a new + attribute to the Element. + + Retrieve first address element and add + a new attribute node to it by invoking its + "setAttributeNode(newAttr)" method. This test makes use + of the "createAttribute(name)" method from the Document + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function elementcreatenewattribute() { + var success; + if(checkInitialization(builder, "elementcreatenewattribute") != null) return; + var doc; + var elementList; + var testAddress; + var newAttribute; + var oldAttr; + var districtAttr; + var attrVal; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(0); + newAttribute = doc.createAttribute("district"); + oldAttr = testAddress.setAttributeNode(newAttribute); + assertNull("old_attr_doesnt_exist",oldAttr); + districtAttr = testAddress.getAttributeNode("district"); + assertNotNull("new_district_accessible",districtAttr); +attrVal = testAddress.getAttribute("district"); + assertEquals("attr_value","",attrVal); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementcreatenewattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html new file mode 100644 index 0000000000..b1d72647dd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenode.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetattributenode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetattributenode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributeNode(name)" method retrieves an + attribute node by name. + + Retrieve the attribute "domestic" from the last child + of the first employee. Since the method returns an + Attr object, the "name" can be examined to ensure the + proper attribute was retrieved. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 +*/ +function elementgetattributenode() { + var success; + if(checkInitialization(builder, "elementgetattributenode") != null) return; + var doc; + var elementList; + var testEmployee; + var domesticAttr; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(0); + domesticAttr = testEmployee.getAttributeNode("domestic"); + name = domesticAttr.nodeName; + + assertEquals("elementGetAttributeNodeAssert","domestic",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html new file mode 100644 index 0000000000..22c42058ce --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetattributenodenull.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetattributenodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetattributenodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributeNode(name)" method retrieves an + attribute node by name. It should return null if the + "name" attribute does not exist. + + Retrieve the last child of the first employee and attempt + to retrieve a non-existing attribute. The method should + return "null". The non-existing attribute to be used + is "invalidAttribute". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 +*/ +function elementgetattributenodenull() { + var success; + if(checkInitialization(builder, "elementgetattributenodenull") != null) return; + var doc; + var elementList; + var testEmployee; + var domesticAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(0); + domesticAttr = testEmployee.getAttributeNode("invalidAttribute"); + assertNull("elementGetAttributeNodeNullAssert",domesticAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetattributenodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html new file mode 100644 index 0000000000..ef32feb8a8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementempty.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementempty</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementempty']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementempty'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttribute(name)" method returns an empty + string if no value was assigned to an attribute and + no default value was given in the DTD file. + + Retrieve the last child of the last employee, then + invoke "getAttribute(name)" method, where "name" is an + attribute without a specified or DTD default value. + The "getAttribute(name)" method should return the empty + string. This method makes use of the + "createAttribute(newAttr)" method from the Document + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 +*/ +function elementgetelementempty() { + var success; + if(checkInitialization(builder, "elementgetelementempty") != null) return; + var doc; + var newAttribute; + var elementList; + var testEmployee; + var domesticAttr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newAttribute = doc.createAttribute("district"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(3); + domesticAttr = testEmployee.setAttributeNode(newAttribute); + attrValue = testEmployee.getAttribute("district"); + assertEquals("elementGetElementEmptyAssert","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementempty</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html new file mode 100644 index 0000000000..72ad7f0811 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagname.html @@ -0,0 +1,127 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method returns a list +of all descendant Elements with the given tag name. +Test for an empty list. + +Create a NodeList of all the descendant elements +using the string "noMatch" as the tagName. +The method should return a NodeList whose length is +"0" since there are not any descendant elements +that match the given tag name. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function elementgetelementsbytagname() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagname") != null) return; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + assertSize("elementGetElementsByTagNameAssert",5,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html new file mode 100644 index 0000000000..0a3dce9ebc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnameaccessnodelist.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnameaccessnodelist</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagnameaccessnodelist']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagnameaccessnodelist'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Element.getElementsByTagName("employee") should return a NodeList whose length is +"5" in the order the children were encountered. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function elementgetelementsbytagnameaccessnodelist() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagnameaccessnodelist") != null) return; + var doc; + var elementList; + var testEmployee; + var child; + var childName; + var childValue; + var childType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + testEmployee = elementList.item(3); + child = testEmployee.firstChild; + + childType = child.nodeType; + + + if( + (3 == childType) + ) { + child = child.nextSibling; + + + } + childName = child.nodeName; + + assertEquals("nodename","employeeId",childName); + child = child.firstChild; + + childValue = child.nodeValue; + + assertEquals("emp0004","EMP0004",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnameaccessnodelist</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html new file mode 100644 index 0000000000..bbebeb5a73 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamenomatch.html @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamenomatch</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagnamenomatch']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagnamenomatch'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method returns a list +of all descendant Elements with the given tag name. + +Create a NodeList of all the descendant elements +using the string "employee" as the tagName. +The method should return a NodeList whose length is +"5". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function elementgetelementsbytagnamenomatch() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagnamenomatch") != null) return; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("noMatch"); + assertSize("elementGetElementsByTagNameNoMatchNoMatchAssert",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamenomatch</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html new file mode 100644 index 0000000000..a82b229e6b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgetelementsbytagnamespecialvalue.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamespecialvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagnamespecialvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagnamespecialvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method may use the +special value "*" to match all tags in the element +tree. + +Create a NodeList of all the descendant elements +of the last employee by using the special value "*". +The method should return all the descendant children(6) +in the order the children were encountered. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function elementgetelementsbytagnamespecialvalue() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagnamespecialvalue") != null) return; + var doc; + var elementList; + var lastEmployee; + var lastempList; + var child; + var childName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "employeeId"; + expectedResult[1] = "name"; + expectedResult[2] = "position"; + expectedResult[3] = "salary"; + expectedResult[4] = "gender"; + expectedResult[5] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + lastEmployee = elementList.item(4); + lastempList = lastEmployee.getElementsByTagName("*"); + for(var indexN65642 = 0;indexN65642 < lastempList.length; indexN65642++) { + child = lastempList.item(indexN65642); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsList("tagNames",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamespecialvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementgettagname.html b/dom/tests/mochitest/dom-level1-core/test_elementgettagname.html new file mode 100644 index 0000000000..2ddf8c9463 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementgettagname.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgettagname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgettagname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgettagname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getTagName()" method returns the + + tagName of an element. + + + + Invoke the "getTagName()" method one the + + root node. The value returned should be "staff". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function elementgettagname() { + var success; + if(checkInitialization(builder, "elementgettagname") != null) return; + var doc; + var root; + var tagname; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + root = doc.documentElement; + + tagname = root.tagName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgTagName","svg",tagname); + + } + + else { + assertEquals("elementGetTagNameAssert","staff",tagname); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgettagname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html new file mode 100644 index 0000000000..a87e71cf09 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementinuseattributeerr.html @@ -0,0 +1,153 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinuseattributeerr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementinuseattributeerr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementinuseattributeerr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method raises an + "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" + is already an attribute of another element. + + Retrieve the last child of the second employee and append + a newly created element. The "createAttribute(name)" + and "setAttributeNode(newAttr)" methods are invoked + to create and add a new attribute to the newly created + Element. The "setAttributeNode(newAttr)" method is + once again called to add the new attribute causing an + exception to be raised since the attribute is already + an attribute of another element. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +*/ +function elementinuseattributeerr() { + var success; + if(checkInitialization(builder, "elementinuseattributeerr") != null) return; + var doc; + var newAttribute; + var addressElementList; + var testAddress; + var newElement; + var appendedChild; + var setAttr1; + var setAttr2; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressElementList = doc.getElementsByTagName("address"); + testAddress = addressElementList.item(1); + newElement = doc.createElement("newElement"); + appendedChild = testAddress.appendChild(newElement); + newAttribute = doc.createAttribute("newAttribute"); + setAttr1 = newElement.setAttributeNode(newAttribute); + + { + success = false; + try { + setAttr2 = testAddress.setAttributeNode(newAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("throw_INUSE_ATTRIBUTE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinuseattributeerr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html b/dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html new file mode 100644 index 0000000000..aa64f2c814 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementinvalidcharacterexception.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinvalidcharacterexception</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementinvalidcharacterexception']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementinvalidcharacterexception'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "setAttribute(name,value)" method raises an + + "INVALID_CHARACTER_ERR DOMException if the specified + + name contains an invalid character. + + + + Retrieve the last child of the first employee and + + call its "setAttribute(name,value)" method with + + "name" containing an invalid character. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function elementinvalidcharacterexception() { + var success; + if(checkInitialization(builder, "elementinvalidcharacterexception") != null) return; + var doc; + var elementList; + var testAddress; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(0); + + { + success = false; + try { + testAddress.setAttribute("invalid^Name","value"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinvalidcharacterexception</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementnormalize.html b/dom/tests/mochitest/dom-level1-core/test_elementnormalize.html new file mode 100644 index 0000000000..ac0100807d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementnormalize.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnormalize</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementnormalize']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementnormalize'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "normalize()" method puts all the nodes in the full + depth of the sub-tree underneath this element into a + "normal" form. + + Retrieve the third employee and access its second child. + This child contains a block of text that is spread + across multiple lines. The content of the "name" child + should be parsed and treated as a single Text node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 +*/ +function elementnormalize() { + var success; + if(checkInitialization(builder, "elementnormalize") != null) return; + var doc; + var root; + var elementList; + var testName; + var firstChild; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + root = doc.documentElement; + + root.normalize(); + elementList = root.getElementsByTagName("name"); + testName = elementList.item(2); + firstChild = testName.firstChild; + + childValue = firstChild.nodeValue; + + assertEquals("elementNormalizeAssert","Roger\n Jones",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnormalize</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html new file mode 100644 index 0000000000..e75e633aac --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementnotfounderr.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnotfounderr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementnotfounderr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementnotfounderr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method raises a + NOT_FOUND_ERR DOMException if the "oldAttr" attribute + is not an attribute of the element. + + Retrieve the last employee and attempt to remove + a non existing attribute node. This should cause the + intended exception to be raised. This test makes use + of the "createAttribute(name)" method from the Document + interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function elementnotfounderr() { + var success; + if(checkInitialization(builder, "elementnotfounderr") != null) return; + var doc; + var oldAttribute; + var addressElementList; + var testAddress; + var attrAddress; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressElementList = doc.getElementsByTagName("address"); + testAddress = addressElementList.item(4); + oldAttribute = doc.createAttribute("oldAttribute"); + + { + success = false; + try { + attrAddress = testAddress.removeAttributeNode(oldAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementnotfounderr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html new file mode 100644 index 0000000000..cd7f3a63a5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattribute.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttribute(name)" removes an attribute by name. + If the attribute has a default value, it is immediately + replaced. + + Retrieve the attribute named "street" from the last child + of the fourth employee, then remove the "street" + attribute by invoking the "removeAttribute(name)" method. + The "street" attribute has a default value defined in the + DTD file, that value should immediately replace the old + value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function elementremoveattribute() { + var success; + if(checkInitialization(builder, "elementremoveattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(3); + testEmployee.removeAttribute("street"); + attrValue = testEmployee.getAttribute("street"); + assertEquals("streetYes","Yes",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html new file mode 100644 index 0000000000..8ba3bb22bc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributeaftercreate.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributeaftercreate</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributeaftercreate']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributeaftercreate'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method removes the + specified attribute. + + Retrieve the last child of the third employee, add a + new "district" node to it and then try to remove it. + To verify that the node was removed use the + "getNamedItem(name)" method from the NamedNodeMap + interface. It also uses the "getAttributes()" method + from the Node interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +*/ +function elementremoveattributeaftercreate() { + var success; + if(checkInitialization(builder, "elementremoveattributeaftercreate") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var attributes; + var districtAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("district"); + districtAttr = testEmployee.setAttributeNode(newAttribute); + districtAttr = testEmployee.removeAttributeNode(newAttribute); + attributes = testEmployee.attributes; + + districtAttr = attributes.getNamedItem("district"); + assertNull("elementRemoveAttributeAfterCreateAssert",districtAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributeaftercreate</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html new file mode 100644 index 0000000000..816400b456 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenode.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributenode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributenode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method returns the + node that was removed. + + Retrieve the last child of the third employee and + remove its "street" Attr node. The method should + return the old attribute node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +*/ +function elementremoveattributenode() { + var success; + if(checkInitialization(builder, "elementremoveattributenode") != null) return; + var doc; + var elementList; + var testEmployee; + var streetAttr; + var removedAttr; + var removedValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + streetAttr = testEmployee.getAttributeNode("street"); + removedAttr = testEmployee.removeAttributeNode(streetAttr); + removedValue = removedAttr.value; + + assertEquals("elementRemoveAttributeNodeAssert","No",removedValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html new file mode 100644 index 0000000000..2fce51ea1a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederr.html @@ -0,0 +1,170 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributenodenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributenodenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "removeAttributeNode(oldAttr)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +*/ +function elementremoveattributenodenomodificationallowederr() { + var success; + if(checkInitialization(builder, "elementremoveattributenodenomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var genList; + var gen; + var nodeType; + var gList; + var genElement; + var attrList; + var attrNode; + var removedAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + genList = gender.childNodes; + + gen = genList.item(0); + assertNotNull("genNotNull",gen); +nodeType = gen.nodeType; + + + if( + (1 == nodeType) + ) { + gen = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",gen); + + } + gList = gen.childNodes; + + genElement = gList.item(0); + assertNotNull("genElementNotNull",genElement); +attrList = genElement.attributes; + + attrNode = attrList.getNamedItem("domestic"); + + { + success = false; + try { + removedAttr = genElement.removeAttributeNode(attrNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html new file mode 100644 index 0000000000..8722318cb4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenodenomodificationallowederrEE.html @@ -0,0 +1,158 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributenodenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributenodenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an entity reference and add it to the children of the THIRD "gender" element. + Try to remove the "domestic" attribute from the entity + reference by executing the "removeAttributeNode(oldAttr)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederr.xml +*/ +function elementremoveattributenodenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "elementremoveattributenodenomodificationallowederrEE") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + var attrList; + var attrNode; + var nodeType; + var removedAttr; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +appendedChild = gender.appendChild(entRef); + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +attrList = entElement.attributes; + + attrNode = attrList.getNamedItem("domestic"); + assertNotNull("attrNodeNotNull",attrNode); + + { + success = false; + try { + removedAttr = entElement.removeAttributeNode(attrNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenodenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html new file mode 100644 index 0000000000..542f26aedc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederr.html @@ -0,0 +1,164 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttribute(name)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "removeAttribute(name)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6D6AC0F9')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +*/ +function elementremoveattributenomodificationallowederr() { + var success; + if(checkInitialization(builder, "elementremoveattributenomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var genList; + var gen; + var gList; + var nodeType; + var genElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + genList = gender.childNodes; + + gen = genList.item(0); + assertNotNull("genNotNull",gen); +nodeType = gen.nodeType; + + + if( + (1 == nodeType) + ) { + gen = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",gen); + + } + gList = gen.childNodes; + + genElement = gList.item(0); + assertNotNull("genElementNotNull",genElement); + + { + success = false; + try { + genElement.removeAttribute("domestic"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html new file mode 100644 index 0000000000..36965ef362 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributenomodificationallowederrEE.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttribute(name)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an reference the entity ent4 and add it to the THIRD "gender" element. + Try to remove the "domestic" attribute from the entity reference by executing the "removeAttribute(name)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6D6AC0F9')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederr.xml +*/ +function elementremoveattributenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "elementremoveattributenomodificationallowederrEE") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +appendedChild = gender.appendChild(entRef); + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); + + { + success = false; + try { + entElement.removeAttribute("domestic"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html new file mode 100644 index 0000000000..8c8b56b43e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementremoveattributerestoredefaultvalue.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributerestoredefaultvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributerestoredefaultvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementremoveattributerestoredefaultvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method removes the + specified attribute node and restores any default values. + + Retrieve the last child of the third employeed and + remove its "street" Attr node. Since this node has a + default value defined in the DTD file, that default + should immediately be the new value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function elementremoveattributerestoredefaultvalue() { + var success; + if(checkInitialization(builder, "elementremoveattributerestoredefaultvalue") != null) return; + var doc; + var elementList; + var testEmployee; + var streetAttr; + var attribute; + var removedAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + streetAttr = testEmployee.getAttributeNode("street"); + removedAttr = testEmployee.removeAttributeNode(streetAttr); + attribute = testEmployee.getAttribute("street"); + assertEquals("streetYes","Yes",attribute); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributerestoredefaultvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html b/dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html new file mode 100644 index 0000000000..68742fb8e7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementreplaceattributewithself.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceattributewithself</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementreplaceattributewithself']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementreplaceattributewithself'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +This test calls setAttributeNode to replace an attribute with itself. +Since the node is not an attribute of another Element, it would +be inappropriate to throw an INUSE_ATTRIBUTE_ERR. + +This test was derived from elementinuserattributeerr which +inadvertanly made this test. + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function elementreplaceattributewithself() { + var success; + if(checkInitialization(builder, "elementreplaceattributewithself") != null) return; + var doc; + var elementList; + var testEmployee; + var streetAttr; + var replacedAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + streetAttr = testEmployee.getAttributeNode("street"); + replacedAttr = testEmployee.setAttributeNode(streetAttr); + assertSame("replacedAttr",streetAttr,replacedAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceattributewithself</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html new file mode 100644 index 0000000000..408fdc8634 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattribute.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementreplaceexistingattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementreplaceexistingattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method adds a new + attribute to the Element. If the "newAttr" Attr node is + already present in this element, it should replace the + existing one. + + Retrieve the last child of the third employee and add a + new attribute node by invoking the "setAttributeNode(new + Attr)" method. The new attribute node to be added is + "street", which is already present in this element. The + method should replace the existing Attr node with the + new one. This test uses the "createAttribute(name)" + method from the Document interface. + +* @author NIST +* @author Mary Brady +*/ +function elementreplaceexistingattribute() { + var success; + if(checkInitialization(builder, "elementreplaceexistingattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var name; + var setAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("street"); + setAttr = testEmployee.setAttributeNode(newAttribute); + name = testEmployee.getAttribute("street"); + assertEquals("elementReplaceExistingAttributeAssert","",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html new file mode 100644 index 0000000000..2722367f30 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementreplaceexistingattributegevalue.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattributegevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementreplaceexistingattributegevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementreplaceexistingattributegevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +If the "setAttributeNode(newAttr)" method replaces an +existing Attr node with the same name, then it should +return the previously existing Attr node. + +Retrieve the last child of the third employee and add a +new attribute node. The new attribute node is "street", +which is already present in this Element. The method +should return the existing Attr node(old "street" Attr). +This test uses the "createAttribute(name)" method +from the Document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function elementreplaceexistingattributegevalue() { + var success; + if(checkInitialization(builder, "elementreplaceexistingattributegevalue") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("street"); + streetAttr = testEmployee.setAttributeNode(newAttribute); + value = streetAttr.value; + + assertEquals("streetNo","No",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementreplaceexistingattributegevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html b/dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html new file mode 100644 index 0000000000..9b3e981231 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementretrieveallattributes.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveallattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementretrieveallattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementretrieveallattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method(Node Interface) may + be used to retrieve the set of all attributes of an + element. + + Create a list of all the attributes of the last child + of the first employee by using the "getAttributes()" + method. Examine the length of the attribute list. + This test uses the "getLength()" method from the + NameNodeMap interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function elementretrieveallattributes() { + var success; + if(checkInitialization(builder, "elementretrieveallattributes") != null) return; + var doc; + var addressList; + var testAddress; + var attributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addressList = doc.getElementsByTagName("address"); + testAddress = addressList.item(0); + attributes = testAddress.attributes; + + assertSize("elementRetrieveAllAttributesAssert",2,attributes); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveallattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html b/dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html new file mode 100644 index 0000000000..ad2e7fe4fe --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementretrieveattrvalue.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveattrvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementretrieveattrvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementretrieveattrvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttribute(name)" method returns an attribute + value by name. + + Retrieve the second address element, then + invoke the 'getAttribute("street")' method. This should + return the value of the attribute("No"). + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 +*/ +function elementretrieveattrvalue() { + var success; + if(checkInitialization(builder, "elementretrieveattrvalue") != null) return; + var doc; + var elementList; + var testAddress; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(2); + attrValue = testAddress.getAttribute("street"); + assertEquals("attrValue","No",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrieveattrvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html b/dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html new file mode 100644 index 0000000000..5082f76b4f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementretrievetagname.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrievetagname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementretrievetagname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementretrievetagname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getElementsByTagName()" method returns a NodeList + of all descendant elements with a given tagName. + + Invoke the "getElementsByTagName()" method and create + a NodeList of "position" elements. Retrieve the second + "position" element in the list and return the NodeName. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 +*/ +function elementretrievetagname() { + var success; + if(checkInitialization(builder, "elementretrievetagname") != null) return; + var doc; + var elementList; + var testEmployee; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("position"); + testEmployee = elementList.item(1); + name = testEmployee.nodeName; + + assertEquals("nodename","position",name); + name = testEmployee.tagName; + + assertEquals("tagname","position",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementretrievetagname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html new file mode 100644 index 0000000000..d58ebc80fa --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederr.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "setAttributeNode(newAttr)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function elementsetattributenodenomodificationallowederr() { + var success; + if(checkInitialization(builder, "elementsetattributenodenomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + var newAttr; + var nodeType; + var badAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = gender.firstChild; + + assertNotNull("entRefNotNull",entRef); +nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +newAttr = doc.createAttribute("newAttr"); + + { + success = false; + try { + badAttr = entElement.setAttributeNode(newAttr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html new file mode 100644 index 0000000000..c4dc54be3c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenomodificationallowederrEE.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("expandEntityReferences", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an entity reference and add to the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "setAttributeNode(newAttr)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederr.xml +*/ +function elementsetattributenodenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "elementsetattributenodenomodificationallowederrEE") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + var newAttr; + var badAttr; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +appendedChild = gender.appendChild(entRef); + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +newAttr = doc.createAttribute("newAttr"); + + { + success = false; + try { + badAttr = entElement.setAttributeNode(newAttr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html new file mode 100644 index 0000000000..a409168c4a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenodenull.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method returns the + null value if no previously existing Attr node with the + same name was replaced. + + Retrieve the last child of the third employee and add a + new attribute to it. The new attribute node added is + "district", which is not part of this Element. The + method should return the null value. + This test uses the "createAttribute(name)" + method from the Document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function elementsetattributenodenull() { + var success; + if(checkInitialization(builder, "elementsetattributenodenull") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var districtAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("district"); + districtAttr = testEmployee.setAttributeNode(newAttribute); + assertNull("elementSetAttributeNodeNullAssert",districtAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html new file mode 100644 index 0000000000..202ef30245 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederr.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("expandEntityReferences", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "setAttribute(name,value)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +*/ +function elementsetattributenomodificationallowederr() { + var success; + if(checkInitialization(builder, "elementsetattributenomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = gender.firstChild; + + assertNotNull("entRefNotNull",entRef); +entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); + + { + success = false; + try { + entElement.setAttribute("newAttr","newValue"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html new file mode 100644 index 0000000000..9fe4d14ba0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementsetattributenomodificationallowederrEE.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method for an attribute causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Add an ent4 reference to the children of the THIRD "gender" element. + Try to remove the "domestic" attribute + from the entity reference by executing the "setAttribute(name,value)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederr.xml +*/ +function elementsetattributenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "elementsetattributenomodificationallowederrEE") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = doc.createEntityReference("ent4"); + appendedChild = gender.appendChild(entRef); + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); + + { + success = false; + try { + entElement.setAttribute("newAttr","newValue"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementsetattributenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html new file mode 100644 index 0000000000..72ba6534c2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_elementwrongdocumenterr.html @@ -0,0 +1,174 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementwrongdocumenterr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementwrongdocumenterr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementwrongdocumenterr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "setAttributeNode(newAttr)" method raises an + + "WRONG_DOCUMENT_ERR DOMException if the "newAttr" + + was created from a different document than the one that + + created this document. + + + + Retrieve the last employee and attempt to set a new + + attribute node for its "employee" element. The new + + attribute was created from a document other than the + + one that created this element, therefore a + + WRONG_DOCUMENT_ERR DOMException should be raised. + + This test uses the "createAttribute(newAttr)" method + + from the Document interface. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function elementwrongdocumenterr() { + var success; + if(checkInitialization(builder, "elementwrongdocumenterr") != null) return; + var doc1; + var doc2; + var newAttribute; + var addressElementList; + var testAddress; + var attrAddress; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "staff"); + newAttribute = doc2.createAttribute("newAttribute"); + addressElementList = doc1.getElementsByTagName("address"); + testAddress = addressElementList.item(4); + + { + success = false; + try { + attrAddress = testAddress.setAttributeNode(newAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementwrongdocumenterr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html b/dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html new file mode 100644 index 0000000000..d25572e980 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_entitygetentityname.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetentityname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['entitygetentityname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'entitygetentityname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The nodeName attribute that is inherited from Node + contains the name of the entity. + + Retrieve the entity named "ent1" and access its name by + invoking the "getNodeName()" method inherited from + the Node interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function entitygetentityname() { + var success; + if(checkInitialization(builder, "entitygetentityname") != null) return; + var doc; + var docType; + var entityList; + var entityNode; + var entityName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); +entityNode = entityList.getNamedItem("ent1"); + entityName = entityNode.nodeName; + + assertEquals("entityGetEntityNameAssert","ent1",entityName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetentityname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html new file mode 100644 index 0000000000..c308e4ae66 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicid.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicid</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['entitygetpublicid']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'entitygetpublicid'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getPublicId()" method of an Entity node contains + the public identifier associated with the entity, if + one was specified. + + Retrieve the entity named "ent5" and access its + public identifier. The string "entityURI" should be + returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D7303025 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6ABAEB38 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D7C29F3E +*/ +function entitygetpublicid() { + var success; + if(checkInitialization(builder, "entitygetpublicid") != null) return; + var doc; + var docType; + var entityList; + var entityNode; + var publicId; + var systemId; + var notation; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); +entityNode = entityList.getNamedItem("ent5"); + publicId = entityNode.publicId; + + assertEquals("publicId","entityURI",publicId); + systemId = entityNode.systemId; + + assertURIEquals("systemId",null,null,null,"entityFile",null,null,null,null,systemId); +notation = entityNode.notationName; + + assertEquals("notation","notation1",notation); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicid</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html new file mode 100644 index 0000000000..b6d9647d06 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_entitygetpublicidnull.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicidnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['entitygetpublicidnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'entitygetpublicidnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getPublicId()" method of an Entity node contains + the public identifier associated with the entity, if + one was not specified a null value should be returned. + + Retrieve the entity named "ent1" and access its + public identifier. Since a public identifier was not + specified for this entity, the "getPublicId()" method + should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D7303025 +*/ +function entitygetpublicidnull() { + var success; + if(checkInitialization(builder, "entitygetpublicidnull") != null) return; + var doc; + var docType; + var entityList; + var entityNode; + var publicId; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); +entityNode = entityList.getNamedItem("ent1"); + publicId = entityNode.publicId; + + assertNull("entityGetPublicIdNullAssert",publicId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/entitygetpublicidnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html new file mode 100644 index 0000000000..4e4e801e82 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild1.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrappendchild1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrappendchild1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a text node to an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_attrappendchild1() { + var success; + if(checkInitialization(builder, "hc_attrappendchild1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + retval = titleAttr.appendChild(textNode); + value = titleAttr.value; + + assertEquals("attrValue","Yesterday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + value = retval.nodeValue; + + assertEquals("retvalValue","terday",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","terday",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html new file mode 100644 index 0000000000..93e0c8e6af --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild2.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrappendchild2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrappendchild2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Attempts to append an element to the child nodes of an attribute. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_attrappendchild2() { + var success; + if(checkInitialization(builder, "hc_attrappendchild2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var newChild; + var retval; + var lastChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + newChild = doc.createElement("terday"); + + { + success = false; + try { + retval = titleAttr.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html new file mode 100644 index 0000000000..a7c691d00a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild3.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild3</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrappendchild3']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrappendchild3'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a document fragment to an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_attrappendchild3() { + var success; + if(checkInitialization(builder, "hc_attrappendchild3") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var terNode; + var dayNode; + var retval; + var lastChild; + var docFrag; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + terNode = doc.createTextNode("ter"); + dayNode = doc.createTextNode("day"); + docFrag = doc.createDocumentFragment(); + retval = docFrag.appendChild(terNode); + retval = docFrag.appendChild(dayNode); + retval = titleAttr.appendChild(docFrag); + value = titleAttr.value; + + assertEquals("attrValue","Yesterday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + value = retval.nodeValue; + + assertNull("retvalValue",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","day",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild3</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html new file mode 100644 index 0000000000..1b7dc9680e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild4.html @@ -0,0 +1,168 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild4</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrappendchild4']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrappendchild4'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Attempt to append a CDATASection to an attribute which should result +in a HIERARCHY_REQUEST_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_attrappendchild4() { + var success; + if(checkInitialization(builder, "hc_attrappendchild4") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + textNode = doc.createCDATASection("terday"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + textNode = doc.createCDATASection("terday"); + + { + success = false; + try { + retval = titleAttr.appendChild(textNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild4</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html new file mode 100644 index 0000000000..75116fe76b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild5.html @@ -0,0 +1,159 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild5</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrappendchild5']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + var otherDocRef = null; + if (typeof(this.otherDoc) != 'undefined') { + otherDocRef = this.otherDoc; + } + docsLoaded += preload(otherDocRef, "otherDoc", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrappendchild5'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Attempt to append a node from another document to an attribute which should result +in a WRONG_DOCUMENT_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_attrappendchild5() { + var success; + if(checkInitialization(builder, "hc_attrappendchild5") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + var otherDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + var otherDocRef = null; + if (typeof(this.otherDoc) != 'undefined') { + otherDocRef = this.otherDoc; + } + otherDoc = load(otherDocRef, "otherDoc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = otherDoc.createTextNode("terday"); + + { + success = false; + try { + retval = titleAttr.appendChild(textNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild5</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +<iframe name="otherDoc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html new file mode 100644 index 0000000000..2ab7c9cc0f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrappendchild6.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild6</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrappendchild6']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrappendchild6'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Creates an new attribute node and appends a text node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_attrappendchild6() { + var success; + if(checkInitialization(builder, "hc_attrappendchild6") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + titleAttr = doc.createAttribute("title"); + textNode = doc.createTextNode("Yesterday"); + retval = titleAttr.appendChild(textNode); + value = titleAttr.value; + + assertEquals("attrValue","Yesterday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + value = retval.nodeValue; + + assertEquals("retvalValue","Yesterday",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","Yesterday",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild6</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html new file mode 100644 index 0000000000..ad3f06682e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes1.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrchildnodes1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrchildnodes1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks that Node.childNodes for an attribute node contains +the expected text node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +*/ +function hc_attrchildnodes1() { + var success; + if(checkInitialization(builder, "hc_attrchildnodes1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var childNodes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + childNodes = titleAttr.childNodes; + + assertSize("childNodesSize",1,childNodes); +textNode = childNodes.item(0); + value = textNode.nodeValue; + + assertEquals("child1IsYes","Yes",value); + textNode = childNodes.item(1); + assertNull("secondItemIsNull",textNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html new file mode 100644 index 0000000000..c48f78dc05 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrchildnodes2.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrchildnodes2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrchildnodes2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks Node.childNodes for an attribute with multiple child nodes. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +*/ +function hc_attrchildnodes2() { + var success; + if(checkInitialization(builder, "hc_attrchildnodes2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var childNodes; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + childNodes = titleAttr.childNodes; + + textNode = doc.createTextNode("terday"); + retval = titleAttr.appendChild(textNode); + assertSize("childNodesSize",2,childNodes); +textNode = childNodes.item(0); + value = textNode.nodeValue; + + assertEquals("child1IsYes","Yes",value); + textNode = childNodes.item(1); + value = textNode.nodeValue; + + assertEquals("child2IsTerday","terday",value); + textNode = childNodes.item(2); + assertNull("thirdItemIsNull",textNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrchildnodes2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html new file mode 100644 index 0000000000..5ee88a5cdf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrclonenode1.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrclonenode1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrclonenode1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrclonenode1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a text node to an attribute and clones the node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function hc_attrclonenode1() { + var success; + if(checkInitialization(builder, "hc_attrclonenode1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + var clonedTitle; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + retval = titleAttr.appendChild(textNode); + clonedTitle = titleAttr.cloneNode(false); + textNode.nodeValue = "text_node_not_cloned"; + + value = clonedTitle.value; + + assertEquals("attrValue","Yesterday",value); + value = clonedTitle.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + lastChild = clonedTitle.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","terday",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrclonenode1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html new file mode 100644 index 0000000000..0c1266f47d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatedocumentfragment.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatedocumentfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrcreatedocumentfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrcreatedocumentfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a new DocumentFragment and add a newly created Element node(with one attribute). + Once the element is added, its attribute should be available as an attribute associated + with an Element within a DocumentFragment. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 +*/ +function hc_attrcreatedocumentfragment() { + var success; + if(checkInitialization(builder, "hc_attrcreatedocumentfragment") != null) return; + var doc; + var docFragment; + var newOne; + var domesticNode; + var attributes; + var attribute; + var attrName; + var appendedChild; + var langAttrCount = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docFragment = doc.createDocumentFragment(); + newOne = doc.createElement("html"); + newOne.setAttribute("lang","EN"); + appendedChild = docFragment.appendChild(newOne); + domesticNode = docFragment.firstChild; + + attributes = domesticNode.attributes; + + for(var indexN65656 = 0;indexN65656 < attributes.length; indexN65656++) { + attribute = attributes.item(indexN65656); + attrName = attribute.nodeName; + + + if( + equalsAutoCase("attribute", "lang", attrName) + ) { + langAttrCount += 1; + + } + + } + assertEquals("hasLangAttr",1,langAttrCount); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatedocumentfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html new file mode 100644 index 0000000000..95bc79e590 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrcreatetextnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrcreatetextnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setValue()" method for an attribute creates a + Text node with the unparsed content of the string. + Retrieve the attribute named "class" from the last + child of of the fourth employee and assign the "Y&ent1;" + string to its value attribute. This value is not yet + parsed and therefore should still be the same upon + retrieval. This test uses the "getNamedItem(name)" method + from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html +*/ +function hc_attrcreatetextnode() { + var success; + if(checkInitialization(builder, "hc_attrcreatetextnode") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(3); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("class"); + streetAttr.value = "Y&ent1;"; + + value = streetAttr.value; + + assertEquals("value","Y&ent1;",value); + value = streetAttr.nodeValue; + + assertEquals("nodeValue","Y&ent1;",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html new file mode 100644 index 0000000000..bd0e58e5b4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrcreatetextnode2.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrcreatetextnode2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrcreatetextnode2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNodeValue()" method for an attribute creates a + Text node with the unparsed content of the string. + Retrieve the attribute named "class" from the last + child of of the fourth employee and assign the "Y&ent1;" + string to its value attribute. This value is not yet + parsed and therefore should still be the same upon + retrieval. This test uses the "getNamedItem(name)" method + from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html +*/ +function hc_attrcreatetextnode2() { + var success; + if(checkInitialization(builder, "hc_attrcreatetextnode2") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(3); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("class"); + streetAttr.nodeValue = "Y&ent1;"; + + value = streetAttr.value; + + assertEquals("value","Y&ent1;",value); + value = streetAttr.nodeValue; + + assertEquals("nodeValue","Y&ent1;",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrcreatetextnode2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html new file mode 100644 index 0000000000..cdee5306fd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attreffectivevalue.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attreffectivevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attreffectivevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attreffectivevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If an Attr is explicitly assigned any value, then that value is the attributes effective value. + Retrieve the attribute named "domestic" from the last child of of the first employee + and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method + from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +*/ +function hc_attreffectivevalue() { + var success; + if(checkInitialization(builder, "hc_attreffectivevalue") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("title"); + value = domesticAttr.nodeValue; + + assertEquals("attrEffectiveValueAssert","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attreffectivevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html new file mode 100644 index 0000000000..91f7dffc7b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrfirstchild.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrfirstchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrfirstchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrfirstchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks that Node.firstChild for an attribute node contains +the expected text node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 +*/ +function hc_attrfirstchild() { + var success; + if(checkInitialization(builder, "hc_attrfirstchild") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var otherChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = titleAttr.firstChild; + + assertNotNull("textNodeNotNull",textNode); +value = textNode.nodeValue; + + assertEquals("child1IsYes","Yes",value); + otherChild = textNode.nextSibling; + + assertNull("nextSiblingIsNull",otherChild); + otherChild = textNode.previousSibling; + + assertNull("previousSiblingIsNull",otherChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrfirstchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html new file mode 100644 index 0000000000..31a1e0947e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue1.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrgetvalue1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrgetvalue1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks the value of an attribute that contains entity references. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +*/ +function hc_attrgetvalue1() { + var success; + if(checkInitialization(builder, "hc_attrgetvalue1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("class"); + value = titleAttr.value; + + assertEquals("attrValue1","Yα",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html new file mode 100644 index 0000000000..cd2187224e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrgetvalue2.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrgetvalue2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrgetvalue2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks the value of an attribute that contains entity references. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +*/ +function hc_attrgetvalue2() { + var success; + if(checkInitialization(builder, "hc_attrgetvalue2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var firstChild; + var alphaRef; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("class"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + alphaRef = doc.createEntityReference("alpha"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + alphaRef = doc.createEntityReference("alpha"); + firstChild = titleAttr.firstChild; + + retval = titleAttr.insertBefore(alphaRef,firstChild); + value = titleAttr.value; + + assertEquals("attrValue1","αYα",value); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrgetvalue2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html new file mode 100644 index 0000000000..9135d6462f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrhaschildnodes.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrhaschildnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrhaschildnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrhaschildnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks that Node.hasChildNodes() is true for an attribute with content. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 +*/ +function hc_attrhaschildnodes() { + var success; + if(checkInitialization(builder, "hc_attrhaschildnodes") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var hasChildNodes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + hasChildNodes = titleAttr.hasChildNodes(); + assertTrue("hasChildrenIsTrue",hasChildNodes); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrhaschildnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html new file mode 100644 index 0000000000..d07c9764ce --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore1.html @@ -0,0 +1,156 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a text node to an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore1() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var firstChild; + var lastChild; + var refChild = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + retval = titleAttr.insertBefore(textNode,refChild); + value = titleAttr.value; + + assertEquals("attrValue","Yesterday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + value = retval.nodeValue; + + assertEquals("retvalValue","terday",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","Yes",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","terday",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html new file mode 100644 index 0000000000..026886b920 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore2.html @@ -0,0 +1,157 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Prepends a text node to an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore2() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var lastChild; + var firstChild; + var refChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + refChild = titleAttr.firstChild; + + retval = titleAttr.insertBefore(textNode,refChild); + value = titleAttr.value; + + assertEquals("attrValue","terdayYes",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","terdayYes",value); + value = retval.nodeValue; + + assertEquals("retvalValue","terday",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","terday",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html new file mode 100644 index 0000000000..3a48a4c24c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore3.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore3</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore3']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore3'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a document fragment to an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore3() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore3") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var terNode; + var dayNode; + var docFrag; + var retval; + var firstChild; + var lastChild; + var refChild = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + terNode = doc.createTextNode("ter"); + dayNode = doc.createTextNode("day"); + docFrag = doc.createDocumentFragment(); + retval = docFrag.appendChild(terNode); + retval = docFrag.appendChild(dayNode); + retval = titleAttr.insertBefore(docFrag,refChild); + value = titleAttr.value; + + assertEquals("attrValue","Yesterday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + value = retval.nodeValue; + + assertNull("retvalValue",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","Yes",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","day",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore3</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html new file mode 100644 index 0000000000..d02c153e06 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore4.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore4</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore4']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore4'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Prepends a document fragment to an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore4() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore4") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var terNode; + var dayNode; + var docFrag; + var retval; + var firstChild; + var lastChild; + var refChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + terNode = doc.createTextNode("ter"); + dayNode = doc.createTextNode("day"); + docFrag = doc.createDocumentFragment(); + retval = docFrag.appendChild(terNode); + retval = docFrag.appendChild(dayNode); + refChild = titleAttr.firstChild; + + retval = titleAttr.insertBefore(docFrag,refChild); + value = titleAttr.value; + + assertEquals("attrValue","terdayYes",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","terdayYes",value); + value = retval.nodeValue; + + assertNull("retvalValue",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","ter",value); + lastChild = titleAttr.lastChild; + + value = lastChild.nodeValue; + + assertEquals("lastChildValue","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore4</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html new file mode 100644 index 0000000000..97a01079b7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore5.html @@ -0,0 +1,169 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore5</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore5']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore5'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Attempt to append a CDATASection to an attribute which should result +in a HIERARCHY_REQUEST_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore5() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore5") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var refChild = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + textNode = doc.createCDATASection("terday"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + textNode = doc.createCDATASection("terday"); + + { + success = false; + try { + retval = titleAttr.insertBefore(textNode,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore5</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html new file mode 100644 index 0000000000..0fcf1a4c3f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore6.html @@ -0,0 +1,160 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore6</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore6']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + var otherDocRef = null; + if (typeof(this.otherDoc) != 'undefined') { + otherDocRef = this.otherDoc; + } + docsLoaded += preload(otherDocRef, "otherDoc", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore6'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Attempt to append a text node from another document to an attribute which should result +in a WRONG_DOCUMENT_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore6() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore6") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var refChild = null; + + var otherDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + var otherDocRef = null; + if (typeof(this.otherDoc) != 'undefined') { + otherDocRef = this.otherDoc; + } + otherDoc = load(otherDocRef, "otherDoc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = otherDoc.createTextNode("terday"); + + { + success = false; + try { + retval = titleAttr.insertBefore(textNode,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore6</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +<iframe name="otherDoc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html new file mode 100644 index 0000000000..e8707d2409 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrinsertbefore7.html @@ -0,0 +1,176 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore7</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrinsertbefore7']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrinsertbefore7'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a document fragment containing a CDATASection to an attribute. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_attrinsertbefore7() { + var success; + if(checkInitialization(builder, "hc_attrinsertbefore7") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var terNode; + var dayNode; + var docFrag; + var retval; + var firstChild; + var lastChild; + var refChild = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + terNode = doc.createTextNode("ter"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + dayNode = doc.createCDATASection("day"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + dayNode = doc.createCDATASection("day"); + docFrag = doc.createDocumentFragment(); + retval = docFrag.appendChild(terNode); + retval = docFrag.appendChild(dayNode); + + { + success = false; + try { + retval = titleAttr.insertBefore(docFrag,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore7</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html new file mode 100644 index 0000000000..99d6545c92 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrlastchild.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrlastchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrlastchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrlastchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Checks that Node.lastChild for an attribute node contains +the expected text node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB +*/ +function hc_attrlastchild() { + var success; + if(checkInitialization(builder, "hc_attrlastchild") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var otherChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = titleAttr.firstChild; + + assertNotNull("textNodeNotNull",textNode); +value = textNode.nodeValue; + + assertEquals("child1IsYes","Yes",value); + otherChild = textNode.nextSibling; + + assertNull("nextSiblingIsNull",otherChild); + otherChild = textNode.previousSibling; + + assertNull("previousSiblingIsNull",otherChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrlastchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrname.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrname.html new file mode 100644 index 0000000000..8310419283 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrname.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the attribute named class from the last + child of of the second "p" element and examine its + NodeName. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +*/ +function hc_attrname() { + var success; + if(checkInitialization(builder, "hc_attrname") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var strong1; + var strong2; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(1); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("class"); + strong1 = streetAttr.nodeName; + + strong2 = streetAttr.name; + + assertEqualsAutoCase("attribute", "nodeName","class",strong1); + assertEqualsAutoCase("attribute", "name","class",strong2); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html new file mode 100644 index 0000000000..3a6c6be0ca --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrnextsiblingnull.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnextsiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrnextsiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrnextsiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getNextSibling()" method for an Attr node should return null. +Retrieve the attribute named "domestic" from the last child of of the +first employee and examine its NextSibling node. This test uses the +"getNamedItem(name)" method from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function hc_attrnextsiblingnull() { + var success; + if(checkInitialization(builder, "hc_attrnextsiblingnull") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var s; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("title"); + s = domesticAttr.nextSibling; + + assertNull("attrNextSiblingNullAssert",s); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnextsiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html new file mode 100644 index 0000000000..e0105a09fd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrnormalize.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnormalize</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrnormalize']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrnormalize'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Appends a text node to an attribute, normalizes the attribute +and checks for a single child node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 +*/ +function hc_attrnormalize() { + var success; + if(checkInitialization(builder, "hc_attrnormalize") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var firstChild; + var secondChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + retval = titleAttr.appendChild(textNode); + textNode = doc.createTextNode(""); + retval = titleAttr.appendChild(textNode); + testNode.normalize(); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Yesterday",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","Yesterday",value); + secondChild = firstChild.nextSibling; + + assertNull("secondChildIsNull",secondChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrnormalize</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html new file mode 100644 index 0000000000..49c4ab08fb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrparentnodenull.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrparentnodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrparentnodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrparentnodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getParentNode()" method for an Attr node should return null. Retrieve +the attribute named "domestic" from the last child of the first employee +and examine its parentNode attribute. This test also uses the "getNamedItem(name)" +method from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function hc_attrparentnodenull() { + var success; + if(checkInitialization(builder, "hc_attrparentnodenull") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var s; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("title"); + s = domesticAttr.parentNode; + + assertNull("attrParentNodeNullAssert",s); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrparentnodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html new file mode 100644 index 0000000000..1d6ab33960 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrprevioussiblingnull.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrprevioussiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrprevioussiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrprevioussiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getPreviousSibling()" method for an Attr node should return null. +Retrieve the attribute named "domestic" from the last child of of the +first employee and examine its PreviousSibling node. This test uses the +"getNamedItem(name)" method from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function hc_attrprevioussiblingnull() { + var success; + if(checkInitialization(builder, "hc_attrprevioussiblingnull") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var s; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("title"); + s = domesticAttr.previousSibling; + + assertNull("attrPreviousSiblingNullAssert",s); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrprevioussiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html new file mode 100644 index 0000000000..eb48bbbcb2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild1.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrremovechild1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrremovechild1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Removes the child node of an attribute and checks that the value is empty. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +*/ +function hc_attrremovechild1() { + var success; + if(checkInitialization(builder, "hc_attrremovechild1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var firstChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = titleAttr.firstChild; + + assertNotNull("attrChildNotNull",textNode); +retval = titleAttr.removeChild(textNode); + value = titleAttr.value; + + assertEquals("attrValue","",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","",value); + value = retval.nodeValue; + + assertEquals("retvalValue","Yes",value); + firstChild = titleAttr.firstChild; + + assertNull("firstChildNull",firstChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html new file mode 100644 index 0000000000..735a9f4cc7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrremovechild2.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrremovechild2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrremovechild2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + +/** +* +Attempts to remove a freshly created text node which should result in a NOT_FOUND_ERR exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +*/ +function hc_attrremovechild2() { + var success; + if(checkInitialization(builder, "hc_attrremovechild2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("Yesterday"); + + { + success = false; + try { + retval = titleAttr.removeChild(textNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrremovechild2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html new file mode 100644 index 0000000000..729346237d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild1.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrreplacechild1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrreplacechild1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Replaces a text node of an attribute and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function hc_attrreplacechild1() { + var success; + if(checkInitialization(builder, "hc_attrreplacechild1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var firstChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + firstChild = titleAttr.firstChild; + + assertNotNull("attrChildNotNull",firstChild); +retval = titleAttr.replaceChild(textNode,firstChild); + value = titleAttr.value; + + assertEquals("attrValue","terday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","terday",value); + value = retval.nodeValue; + + assertEquals("retvalValue","Yes",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","terday",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html new file mode 100644 index 0000000000..1069345ff0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrreplacechild2.html @@ -0,0 +1,157 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrreplacechild2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrreplacechild2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Replaces a text node of an attribute with a document fragment and checks if the value of +the attribute is changed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function hc_attrreplacechild2() { + var success; + if(checkInitialization(builder, "hc_attrreplacechild2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var terNode; + var dayNode; + var docFrag; + var retval; + var firstChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + terNode = doc.createTextNode("ter"); + dayNode = doc.createTextNode("day"); + docFrag = doc.createDocumentFragment(); + retval = docFrag.appendChild(terNode); + retval = docFrag.appendChild(dayNode); + firstChild = titleAttr.firstChild; + + assertNotNull("attrChildNotNull",firstChild); +retval = titleAttr.replaceChild(docFrag,firstChild); + value = titleAttr.value; + + assertEquals("attrValue","terday",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","terday",value); + value = retval.nodeValue; + + assertEquals("retvalValue","Yes",value); + firstChild = titleAttr.firstChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","ter",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrreplacechild2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html new file mode 100644 index 0000000000..1c049e62b9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue1.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrsetvalue1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrsetvalue1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Sets Attr.value on an attribute that only has a simple value. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +*/ +function hc_attrsetvalue1() { + var success; + if(checkInitialization(builder, "hc_attrsetvalue1") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var retval; + var firstChild; + var otherChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + firstChild = titleAttr.firstChild; + + assertNotNull("attrChildNotNull",firstChild); +titleAttr.value = "Tomorrow"; + + firstChild.nodeValue = "impl reused node"; + + value = titleAttr.value; + + assertEquals("attrValue","Tomorrow",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Tomorrow",value); + firstChild = titleAttr.lastChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","Tomorrow",value); + otherChild = firstChild.nextSibling; + + assertNull("nextSiblingIsNull",otherChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html new file mode 100644 index 0000000000..cc7b9ff9dc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrsetvalue2.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrsetvalue2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrsetvalue2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Sets Attr.value on an attribute that should contain multiple child nodes. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 +*/ +function hc_attrsetvalue2() { + var success; + if(checkInitialization(builder, "hc_attrsetvalue2") != null) return; + var doc; + var acronymList; + var testNode; + var attributes; + var titleAttr; + var value; + var textNode; + var retval; + var firstChild; + var otherChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + acronymList = doc.getElementsByTagName("acronym"); + testNode = acronymList.item(3); + attributes = testNode.attributes; + + titleAttr = attributes.getNamedItem("title"); + textNode = doc.createTextNode("terday"); + retval = titleAttr.appendChild(textNode); + firstChild = titleAttr.firstChild; + + assertNotNull("attrChildNotNull",firstChild); +titleAttr.value = "Tomorrow"; + + firstChild.nodeValue = "impl reused node"; + + value = titleAttr.value; + + assertEquals("attrValue","Tomorrow",value); + value = titleAttr.nodeValue; + + assertEquals("attrNodeValue","Tomorrow",value); + firstChild = titleAttr.lastChild; + + value = firstChild.nodeValue; + + assertEquals("firstChildValue","Tomorrow",value); + otherChild = firstChild.nextSibling; + + assertNull("nextSiblingIsNull",otherChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrsetvalue2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html new file mode 100644 index 0000000000..6a684a2fbc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvalue.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrspecifiedvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrspecifiedvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getSpecified()" method for an Attr node should + be set to true if the attribute was explicitly given + a value. + Retrieve the attribute named "domestic" from the last + child of of the first employee and examine the value + returned by the "getSpecified()" method. This test uses + the "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 +*/ +function hc_attrspecifiedvalue() { + var success; + if(checkInitialization(builder, "hc_attrspecifiedvalue") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("title"); + state = domesticAttr.specified; + + assertTrue("acronymTitleSpecified",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html new file mode 100644 index 0000000000..b5402bdc62 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_attrspecifiedvaluechanged.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvaluechanged</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_attrspecifiedvaluechanged']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_attrspecifiedvaluechanged'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getSpecified()" method for an Attr node should return true if the + value of the attribute is changed. + Retrieve the attribute named "class" from the last + child of of the THIRD employee and change its + value to "Yes"(which is the default DTD value). This + should cause the "getSpecified()" method to be true. + This test uses the "setAttribute(name,value)" method + from the Element interface and the "getNamedItem(name)" + method from the NamedNodeMap interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 +*/ +function hc_attrspecifiedvaluechanged() { + var success; + if(checkInitialization(builder, "hc_attrspecifiedvaluechanged") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var streetAttr; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testNode = addressList.item(2); + testNode.setAttribute("class","Yα"); + attributes = testNode.attributes; + + streetAttr = attributes.getNamedItem("class"); + state = streetAttr.specified; + + assertTrue("acronymClassSpecified",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvaluechanged</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html new file mode 100644 index 0000000000..fba42ffca6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddata.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataappenddata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataappenddata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendData(arg)" method appends a string to the end + of the character data of the node. + + Retrieve the character data from the second child + of the first employee. The appendData(arg) method is + called with arg=", Esquire". The method should append + the specified data to the already existing character + data. The new value return by the "getLength()" method + should be 24. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +*/ +function hc_characterdataappenddata() { + var success; + if(checkInitialization(builder, "hc_characterdataappenddata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childValue; + var childLength; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.appendData(", Esquire"); + childValue = child.data; + + childLength = childValue.length; + assertEquals("characterdataAppendDataAssert",24,childLength); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html new file mode 100644 index 0000000000..502e71b816 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataappenddatagetdata.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddatagetdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataappenddatagetdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataappenddatagetdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + On successful invocation of the "appendData(arg)" + method the "getData()" method provides access to the + concatentation of data and the specified string. + + Retrieve the character data from the second child + of the first employee. The appendData(arg) method is + called with arg=", Esquire". The method should append + the specified data to the already existing character + data. The new value return by the "getData()" method + should be "Margaret Martin, Esquire". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F +*/ +function hc_characterdataappenddatagetdata() { + var success; + if(checkInitialization(builder, "hc_characterdataappenddatagetdata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.appendData(", Esquire"); + childData = child.data; + + assertEquals("characterdataAppendDataGetDataAssert","Margaret Martin, Esquire",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddatagetdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html new file mode 100644 index 0000000000..05c5a58ccf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatabegining.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatabegining</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatadeletedatabegining']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatadeletedatabegining'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "deleteData(offset,count)" method removes a range of +characters from the node. Delete data at the beginning +of the character data. + +Retrieve the character data from the last child of the +first employee. The "deleteData(offset,count)" +method is then called with offset=0 and count=16. +The method should delete the characters from position +0 thru position 16. The new value of the character data +should be "Dallas, Texas 98551". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function hc_characterdatadeletedatabegining() { + var success; + if(checkInitialization(builder, "hc_characterdatadeletedatabegining") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(0,16); + childData = child.data; + + assertEquals("data","Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatabegining</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html new file mode 100644 index 0000000000..5e9b8eab27 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataend.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataend</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatadeletedataend']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatadeletedataend'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method removes a range of + characters from the node. Delete data at the end + of the character data. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=30 and count=5. + The method should delete the characters from position + 30 thru position 35. The new value of the character data + should be "1230 North Ave. Dallas, Texas". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function hc_characterdatadeletedataend() { + var success; + if(checkInitialization(builder, "hc_characterdatadeletedataend") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(30,5); + childData = child.data; + + assertEquals("characterdataDeleteDataEndAssert","1230 North Ave. Dallas, Texas ",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataend</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html new file mode 100644 index 0000000000..374641dedc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedataexceedslength.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataexceedslength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatadeletedataexceedslength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatadeletedataexceedslength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the sum of the offset and count used in the + "deleteData(offset,count) method is greater than the + length of the character data then all the characters + from the offset to the end of the data are deleted. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=4 and count=50. + The method should delete the characters from position 4 + to the end of the data since the offset+count(50+4) + is greater than the length of the character data(35). + The new value of the character data should be "1230". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function hc_characterdatadeletedataexceedslength() { + var success; + if(checkInitialization(builder, "hc_characterdatadeletedataexceedslength") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(4,50); + childData = child.data; + + assertEquals("characterdataDeleteDataExceedsLengthAssert","1230",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataexceedslength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html new file mode 100644 index 0000000000..d6cc722bf7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatagetlengthanddata.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatagetlengthanddata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatadeletedatagetlengthanddata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatadeletedatagetlengthanddata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + On successful invocation of the "deleteData(offset,count)" + method, the "getData()" and "getLength()" methods reflect + the changes. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=30 and count=5. + The method should delete the characters from position + 30 thru position 35. The new value of the character data + should be "1230 North Ave. Dallas, Texas" which is + returned by the "getData()" method and "getLength()" + method should return 30". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function hc_characterdatadeletedatagetlengthanddata() { + var success; + if(checkInitialization(builder, "hc_characterdatadeletedatagetlengthanddata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + var childLength; + var result = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(30,5); + childData = child.data; + + assertEquals("data","1230 North Ave. Dallas, Texas ",childData); + childLength = child.length; + + assertEquals("length",30,childLength); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatagetlengthanddata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html new file mode 100644 index 0000000000..4849166842 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatadeletedatamiddle.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatamiddle</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatadeletedatamiddle']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatadeletedatamiddle'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method removes a range of + characters from the node. Delete data in the middle + of the character data. + + Retrieve the character data from the last child of the + first employee. The "deleteData(offset,count)" + method is then called with offset=16 and count=8. + The method should delete the characters from position + 16 thru position 24. The new value of the character data + should be "1230 North Ave. Texas 98551". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function hc_characterdatadeletedatamiddle() { + var success; + if(checkInitialization(builder, "hc_characterdatadeletedatamiddle") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.deleteData(16,8); + childData = child.data; + + assertEquals("characterdataDeleteDataMiddleAssert","1230 North Ave. Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatamiddle</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html new file mode 100644 index 0000000000..4633933e0c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetdata.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatagetdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatagetdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getData()" method retrieves the character data + + currently stored in the node. + + Retrieve the character data from the second child + + of the first employee and invoke the "getData()" + + method. The method returns the character data + + string. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +*/ +function hc_characterdatagetdata() { + var success; + if(checkInitialization(builder, "hc_characterdatagetdata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + childData = child.data; + + assertEquals("characterdataGetDataAssert","Margaret Martin",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html new file mode 100644 index 0000000000..22981ed603 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatagetlength.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetlength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatagetlength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatagetlength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of characters + stored in this nodes data. + Retrieve the character data from the second + child of the first employee and examine the + value returned by the getLength() method. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C +*/ +function hc_characterdatagetlength() { + var success; + if(checkInitialization(builder, "hc_characterdatagetlength") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childValue; + var childLength; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + childValue = child.data; + + childLength = childValue.length; + assertEquals("characterdataGetLengthAssert",15,childLength); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetlength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html new file mode 100644 index 0000000000..95b68700bf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedatacountnegative.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrdeletedatacountnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrdeletedatacountnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified count + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "deleteData(offset,count)" + method with offset=10 and count=-3. It should raise the + desired exception since the count is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function hc_characterdataindexsizeerrdeletedatacountnegative() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedatacountnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childSubstring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + childSubstring = child.substringData(10,-3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html new file mode 100644 index 0000000000..3bc5f19ffe --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetgreater.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrdeletedataoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrdeletedataoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater that the number of characters in the string. + + Retrieve the character data of the last child of the + first employee and invoke its "deleteData(offset,count)" + method with offset=40 and count=3. It should raise the + desired exception since the offset is greater than the + number of characters in the string. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_characterdataindexsizeerrdeletedataoffsetgreater() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(40,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html new file mode 100644 index 0000000000..099faec06c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrdeletedataoffsetnegative.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrdeletedataoffsetnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrdeletedataoffsetnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "deleteData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "deleteData(offset,count)" + method with offset=-5 and count=3. It should raise the + desired exception since the offset is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +*/ +function hc_characterdataindexsizeerrdeletedataoffsetnegative() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(-5,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html new file mode 100644 index 0000000000..21b42e1ab0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetgreater.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrinsertdataoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrinsertdataoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater than the number of characters in the string. + + Retrieve the character data of the last child of the + first employee and invoke its insertData"(offset,arg)" + method with offset=40 and arg="ABC". It should raise + the desired exception since the offset is greater than + the number of characters in the string. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_characterdataindexsizeerrinsertdataoffsetgreater() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(40,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html new file mode 100644 index 0000000000..aa93eca45e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrinsertdataoffsetnegative.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrinsertdataoffsetnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrinsertdataoffsetnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its insertData"(offset,arg)" + method with offset=-5 and arg="ABC". It should raise + the desired exception since the offset is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function hc_characterdataindexsizeerrinsertdataoffsetnegative() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.replaceData(-5,3,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html new file mode 100644 index 0000000000..6f3dbed097 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedatacountnegative.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrreplacedatacountnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrreplacedatacountnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified count + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its + "replaceData(offset,count,arg) method with offset=10 + and count=-3 and arg="ABC". It should raise the + desired exception since the count is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function hc_characterdataindexsizeerrreplacedatacountnegative() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedatacountnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badString; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badString = child.substringData(10,-3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html new file mode 100644 index 0000000000..119141232e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetgreater.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrreplacedataoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrreplacedataoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater than the length of the string. + + Retrieve the character data of the last child of the + first employee and invoke its + "replaceData(offset,count,arg) method with offset=40 + and count=3 and arg="ABC". It should raise the + desired exception since the offset is greater than the + length of the string. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=242 +*/ +function hc_characterdataindexsizeerrreplacedataoffsetgreater() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.deleteData(40,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html new file mode 100644 index 0000000000..30c9033d9f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrreplacedataoffsetnegative.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrreplacedataoffsetnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrreplacedataoffsetnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its + "replaceData(offset,count,arg) method with offset=-5 + and count=3 and arg="ABC". It should raise the + desired exception since the offset is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function hc_characterdataindexsizeerrreplacedataoffsetnegative() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + child.replaceData(-5,3,"ABC"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html new file mode 100644 index 0000000000..151d6451a7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringcountnegative.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringcountnegative</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrsubstringcountnegative']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrsubstringcountnegative'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified count + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "substringData(offset,count) + method with offset=10 and count=-3. It should raise the + desired exception since the count is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function hc_characterdataindexsizeerrsubstringcountnegative() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringcountnegative") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badSubstring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badSubstring = child.substringData(10,-3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringcountnegative</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html new file mode 100644 index 0000000000..da485c7a95 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringnegativeoffset.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringnegativeoffset</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrsubstringnegativeoffset']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrsubstringnegativeoffset'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is negative. + + Retrieve the character data of the last child of the + first employee and invoke its "substringData(offset,count) + method with offset=-5 and count=3. It should raise the + desired exception since the offset is negative. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function hc_characterdataindexsizeerrsubstringnegativeoffset() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringnegativeoffset") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badString; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badString = child.substringData(-5,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringnegativeoffset</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html new file mode 100644 index 0000000000..853b4f4006 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdataindexsizeerrsubstringoffsetgreater.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdataindexsizeerrsubstringoffsetgreater']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdataindexsizeerrsubstringoffsetgreater'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset + is greater than the number of characters in the string. + + Retrieve the character data of the last child of the + first employee and invoke its "substringData(offset,count) + method with offset=40 and count=3. It should raise the + desired exception since the offsets value is greater + than the length. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_characterdataindexsizeerrsubstringoffsetgreater() { + var success; + if(checkInitialization(builder, "hc_characterdataindexsizeerrsubstringoffsetgreater") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var badString; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + + { + success = false; + try { + badString = child.substringData(40,3); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrsubstringoffsetgreater</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html new file mode 100644 index 0000000000..d482898a05 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatabeginning.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatabeginning</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatainsertdatabeginning']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatainsertdatabeginning'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "insertData(offset,arg)" method will insert a string +at the specified character offset. Insert the data at +the beginning of the character data. + +Retrieve the character data from the second child of +the first employee. The "insertData(offset,arg)" +method is then called with offset=0 and arg="Mss.". +The method should insert the string "Mss." at position 0. +The new value of the character data should be +"Mss. Margaret Martin". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function hc_characterdatainsertdatabeginning() { + var success; + if(checkInitialization(builder, "hc_characterdatainsertdatabeginning") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.insertData(0,"Mss. "); + childData = child.data; + + assertEquals("characterdataInsertDataBeginningAssert","Mss. Margaret Martin",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatabeginning</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html new file mode 100644 index 0000000000..1436b68464 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdataend.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdataend</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatainsertdataend']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatainsertdataend'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method will insert a string + at the specified character offset. Insert the data at + the end of the character data. + + Retrieve the character data from the second child of + the first employee. The "insertData(offset,arg)" + method is then called with offset=15 and arg=", Esquire". + The method should insert the string ", Esquire" at + position 15. The new value of the character data should + be "Margaret Martin, Esquire". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function hc_characterdatainsertdataend() { + var success; + if(checkInitialization(builder, "hc_characterdatainsertdataend") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.insertData(15,", Esquire"); + childData = child.data; + + assertEquals("characterdataInsertDataEndAssert","Margaret Martin, Esquire",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdataend</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html new file mode 100644 index 0000000000..022ce13b9c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatainsertdatamiddle.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatamiddle</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatainsertdatamiddle']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatainsertdatamiddle'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertData(offset,arg)" method will insert a string + at the specified character offset. Insert the data in + the middle of the character data. + + Retrieve the character data from the second child of + the first employee. The "insertData(offset,arg)" + method is then called with offset=9 and arg="Ann". + The method should insert the string "Ann" at position 9. + The new value of the character data should be + "Margaret Ann Martin". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F +*/ +function hc_characterdatainsertdatamiddle() { + var success; + if(checkInitialization(builder, "hc_characterdatainsertdatamiddle") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.insertData(9,"Ann "); + childData = child.data; + + assertEquals("characterdataInsertDataMiddleAssert","Margaret Ann Martin",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdatamiddle</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html new file mode 100644 index 0000000000..9f517bd68f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatabegining.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatabegining</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatareplacedatabegining']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatareplacedatabegining'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "replaceData(offset,count,arg)" method replaces the +characters starting at the specified offset with the +specified string. Test for replacement in the +middle of the data. + +Retrieve the character data from the last child of the +first employee. The "replaceData(offset,count,arg)" +method is then called with offset=5 and count=5 and +arg="South". The method should replace characters five +thru 9 of the character data with "South". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function hc_characterdatareplacedatabegining() { + var success; + if(checkInitialization(builder, "hc_characterdatareplacedatabegining") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(0,4,"2500"); + childData = child.data; + + assertEquals("characterdataReplaceDataBeginingAssert","2500 North Ave. Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatabegining</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html new file mode 100644 index 0000000000..12eb071252 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataend.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataend</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatareplacedataend']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatareplacedataend'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method replaces the + characters starting at the specified offset with the + specified string. Test for replacement at the + end of the data. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=30 and count=5 and + arg="98665". The method should replace characters 30 + thru 34 of the character data with "98665". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function hc_characterdatareplacedataend() { + var success; + if(checkInitialization(builder, "hc_characterdatareplacedataend") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(30,5,"98665"); + childData = child.data; + + assertEquals("characterdataReplaceDataEndAssert","1230 North Ave. Dallas, Texas 98665",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataend</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html new file mode 100644 index 0000000000..b3ba8eb0ad --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofarg.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofarg</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatareplacedataexceedslengthofarg']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatareplacedataexceedslengthofarg'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method replaces the + characters starting at the specified offset with the + specified string. Test the situation where the length + of the arg string is greater than the specified offset. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=0 and count=4 and + arg="260030". The method should replace characters one + thru four with "260030". Note that the length of the + specified string is greater that the specified offset. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function hc_characterdatareplacedataexceedslengthofarg() { + var success; + if(checkInitialization(builder, "hc_characterdatareplacedataexceedslengthofarg") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(0,4,"260030"); + childData = child.data; + + assertEquals("characterdataReplaceDataExceedsLengthOfArgAssert","260030 North Ave. Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofarg</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html new file mode 100644 index 0000000000..747a4c674a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedataexceedslengthofdata.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatareplacedataexceedslengthofdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatareplacedataexceedslengthofdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the sum of the offset and count exceeds the length then + all the characters to the end of the data are replaced. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=0 and count=50 and + arg="2600". The method should replace all the characters + with "2600". This is because the sum of the offset and + count exceeds the length of the character data. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function hc_characterdatareplacedataexceedslengthofdata() { + var success; + if(checkInitialization(builder, "hc_characterdatareplacedataexceedslengthofdata") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(0,50,"2600"); + childData = child.data; + + assertEquals("characterdataReplaceDataExceedsLengthOfDataAssert","2600",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedataexceedslengthofdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html new file mode 100644 index 0000000000..16b522821f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatareplacedatamiddle.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatamiddle</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatareplacedatamiddle']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatareplacedatamiddle'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceData(offset,count,arg)" method replaces the + characters starting at the specified offset with the + specified string. Test for replacement in the + middle of the data. + + Retrieve the character data from the last child of the + first employee. The "replaceData(offset,count,arg)" + method is then called with offset=5 and count=5 and + arg="South". The method should replace characters five + thru 9 of the character data with "South". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB +*/ +function hc_characterdatareplacedatamiddle() { + var success; + if(checkInitialization(builder, "hc_characterdatareplacedatamiddle") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.replaceData(5,5,"South"); + childData = child.data; + + assertEquals("characterdataReplaceDataMiddleAssert","1230 South Ave. Dallas, Texas 98551",childData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatareplacedatamiddle</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html new file mode 100644 index 0000000000..895a5bc724 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasetnodevalue.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasetnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatasetnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatasetnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNodeValue()" method changes the character data + currently stored in the node. + Retrieve the character data from the second child + of the first employee and invoke the "setNodeValue()" + method, call "getData()" and compare. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 +*/ +function hc_characterdatasetnodevalue() { + var success; + if(checkInitialization(builder, "hc_characterdatasetnodevalue") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var childData; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + child.nodeValue = "Marilyn Martin"; + + childData = child.data; + + assertEquals("data","Marilyn Martin",childData); + childValue = child.nodeValue; + + assertEquals("value","Marilyn Martin",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasetnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html new file mode 100644 index 0000000000..dbcdbb01be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringexceedsvalue.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringexceedsvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatasubstringexceedsvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatasubstringexceedsvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the sum of the "offset" and "count" exceeds the + "length" then the "substringData(offset,count)" method + returns all the characters to the end of the data. + + Retrieve the character data from the second child + of the first employee and access part of the data + by using the substringData(offset,count) method + with offset=9 and count=10. The method should return + the substring "Martin" since offset+count > length + (19 > 15). + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +*/ +function hc_characterdatasubstringexceedsvalue() { + var success; + if(checkInitialization(builder, "hc_characterdatasubstringexceedsvalue") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var substring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + substring = child.substringData(9,10); + assertEquals("characterdataSubStringExceedsValueAssert","Martin",substring); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringexceedsvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html new file mode 100644 index 0000000000..a43eaafbe2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_characterdatasubstringvalue.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_characterdatasubstringvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_characterdatasubstringvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "substringData(offset,count)" method returns the + specified string. + + Retrieve the character data from the second child + of the first employee and access part of the data + by using the substringData(offset,count) method. The + method should return the specified substring starting + at position "offset" and extract "count" characters. + The method should return the string "Margaret". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF +*/ +function hc_characterdatasubstringvalue() { + var success; + if(checkInitialization(builder, "hc_characterdatasubstringvalue") != null) return; + var doc; + var elementList; + var nameNode; + var child; + var substring; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(0); + child = nameNode.firstChild; + + substring = child.substringData(0,8); + assertEquals("characterdataSubStringValueAssert","Margaret",substring); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatasubstringvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html b/dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html new file mode 100644 index 0000000000..a07cdd4811 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_commentgetcomment.html @@ -0,0 +1,160 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_commentgetcomment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_commentgetcomment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_commentgetcomment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + A comment is all the characters between the starting + '<!--' and ending '-->' + Retrieve the nodes of the DOM document. Search for a + comment node and the content is its value. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=509 +*/ +function hc_commentgetcomment() { + var success; + if(checkInitialization(builder, "hc_commentgetcomment") != null) return; + var doc; + var elementList; + var child; + var childName; + var childValue; + var commentCount = 0; + var childType; + var attributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.childNodes; + + for(var indexN65630 = 0;indexN65630 < elementList.length; indexN65630++) { + child = elementList.item(indexN65630); + childType = child.nodeType; + + + if( + (8 == childType) + ) { + childName = child.nodeName; + + assertEquals("nodeName","#comment",childName); + childValue = child.nodeValue; + + assertEquals("nodeValue"," This is comment number 1.",childValue); + attributes = child.attributes; + + assertNull("attributes",attributes); + commentCount += 1; + + } + + } + assertTrue("atMostOneComment", + + (commentCount < 2) +); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_commentgetcomment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html new file mode 100644 index 0000000000..dae55673ab --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateattribute.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentcreateattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentcreateattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the entire DOM document and invoke its + "createAttribute(name)" method. It should create a + new Attribute node with the given name. The name, value + and type of the newly created object are retrieved and + output. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_documentcreateattribute() { + var success; + if(checkInitialization(builder, "hc_documentcreateattribute") != null) return; + var doc; + var newAttrNode; + var attrValue; + var attrName; + var attrType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newAttrNode = doc.createAttribute("title"); + attrValue = newAttrNode.nodeValue; + + assertEquals("value","",attrValue); + attrName = newAttrNode.nodeName; + + assertEqualsAutoCase("attribute", "name","title",attrName); + attrType = newAttrNode.nodeType; + + assertEquals("type",2,attrType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html new file mode 100644 index 0000000000..815867fa12 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatecomment.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatecomment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentcreatecomment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentcreatecomment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createComment(data)" method creates a new Comment + node given the specified string. + Retrieve the entire DOM document and invoke its + "createComment(data)" method. It should create a new + Comment node whose "data" is the specified string. + The content, name and type are retrieved and output. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 +*/ +function hc_documentcreatecomment() { + var success; + if(checkInitialization(builder, "hc_documentcreatecomment") != null) return; + var doc; + var newCommentNode; + var newCommentValue; + var newCommentName; + var newCommentType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newCommentNode = doc.createComment("This is a new Comment node"); + newCommentValue = newCommentNode.nodeValue; + + assertEquals("value","This is a new Comment node",newCommentValue); + newCommentName = newCommentNode.nodeName; + + assertEquals("strong","#comment",newCommentName); + newCommentType = newCommentNode.nodeType; + + assertEquals("type",8,newCommentType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatecomment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html new file mode 100644 index 0000000000..084632c381 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatedocumentfragment.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatedocumentfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentcreatedocumentfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentcreatedocumentfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createDocumentFragment()" method creates an empty + DocumentFragment object. + Retrieve the entire DOM document and invoke its + "createDocumentFragment()" method. The content, name, + type and value of the newly created object are output. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 +*/ +function hc_documentcreatedocumentfragment() { + var success; + if(checkInitialization(builder, "hc_documentcreatedocumentfragment") != null) return; + var doc; + var newDocFragment; + var children; + var length; + var newDocFragmentName; + var newDocFragmentType; + var newDocFragmentValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newDocFragment = doc.createDocumentFragment(); + children = newDocFragment.childNodes; + + length = children.length; + + assertEquals("length",0,length); + newDocFragmentName = newDocFragment.nodeName; + + assertEquals("strong","#document-fragment",newDocFragmentName); + newDocFragmentType = newDocFragment.nodeType; + + assertEquals("type",11,newDocFragmentType); + newDocFragmentValue = newDocFragment.nodeValue; + + assertNull("value",newDocFragmentValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatedocumentfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html new file mode 100644 index 0000000000..9f5df4a2c9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelement.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelement</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentcreateelement']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentcreateelement'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createElement(tagName)" method creates an Element + of the type specified. + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method with tagName="acronym". + The method should create an instance of an Element node + whose tagName is "acronym". The NodeName, NodeType + and NodeValue are returned. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +*/ +function hc_documentcreateelement() { + var success; + if(checkInitialization(builder, "hc_documentcreateelement") != null) return; + var doc; + var newElement; + var newElementName; + var newElementType; + var newElementValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newElement = doc.createElement("acronym"); + newElementName = newElement.nodeName; + + assertEqualsAutoCase("element", "strong","acronym",newElementName); + newElementType = newElement.nodeType; + + assertEquals("type",1,newElementType); + newElementValue = newElement.nodeValue; + + assertNull("valueInitiallyNull",newElementValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelement</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html new file mode 100644 index 0000000000..ccad877e48 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreateelementcasesensitive.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentcreateelementcasesensitive']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentcreateelementcasesensitive'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The tagName parameter in the "createElement(tagName)" + method is case-sensitive for XML documents. + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method twice. Once for tagName + equal to "acronym" and once for tagName equal to "ACRONYM" + Each call should create a distinct Element node. The + newly created Elements are then assigned attributes + that are retrieved. + + Modified on 27 June 2003 to avoid setting an invalid style + values and checked the node names to see if they matched expectations. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_documentcreateelementcasesensitive() { + var success; + if(checkInitialization(builder, "hc_documentcreateelementcasesensitive") != null) return; + var doc; + var newElement1; + var newElement2; + var attribute1; + var attribute2; + var nodeName1; + var nodeName2; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newElement1 = doc.createElement("ACRONYM"); + newElement2 = doc.createElement("acronym"); + newElement1.setAttribute("lang","EN"); + newElement2.setAttribute("title","Dallas"); + attribute1 = newElement1.getAttribute("lang"); + attribute2 = newElement2.getAttribute("title"); + assertEquals("attrib1","EN",attribute1); + assertEquals("attrib2","Dallas",attribute2); + nodeName1 = newElement1.nodeName; + + nodeName2 = newElement2.nodeName; + + assertEqualsAutoCase("element", "nodeName1","ACRONYM",nodeName1); + assertEqualsAutoCase("element", "nodeName2","acronym",nodeName2); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html new file mode 100644 index 0000000000..a8d6c6abe1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentcreatetextnode.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatetextnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentcreatetextnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentcreatetextnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createTextNode(data)" method creates a Text node + given the specfied string. + Retrieve the entire DOM document and invoke its + "createTextNode(data)" method. It should create a + new Text node whose "data" is the specified string. + The NodeName and NodeType are also checked. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127 +*/ +function hc_documentcreatetextnode() { + var success; + if(checkInitialization(builder, "hc_documentcreatetextnode") != null) return; + var doc; + var newTextNode; + var newTextName; + var newTextValue; + var newTextType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newTextNode = doc.createTextNode("This is a new Text node"); + newTextValue = newTextNode.nodeValue; + + assertEquals("value","This is a new Text node",newTextValue); + newTextName = newTextNode.nodeName; + + assertEquals("strong","#text",newTextName); + newTextType = newTextNode.nodeType; + + assertEquals("type",3,newTextType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreatetextnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html new file mode 100644 index 0000000000..c63b225b8c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetdoctype.html @@ -0,0 +1,166 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetdoctype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentgetdoctype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentgetdoctype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Access Document.doctype for hc_staff, if not text/html should return DocumentType node. +HTML implementations may return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 +*/ +function hc_documentgetdoctype() { + var success; + if(checkInitialization(builder, "hc_documentgetdoctype") != null) return; + var doc; + var docType; + var docTypeName; + var nodeValue; + var attributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); + + } + + if( + + (docType != null) + + ) { + docTypeName = docType.name; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("nodeNameSVG","svg",docTypeName); + + } + + else { + // Modified to allow lower case for the HTML5 parser and upper case for the old parser + assertTrue("nodeName", "HTML" == docTypeName || "html" == docTypeName); + + } + nodeValue = docType.nodeValue; + + assertNull("nodeValue",nodeValue); + attributes = docType.attributes; + + assertNull("attributes",attributes); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetdoctype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html new file mode 100644 index 0000000000..7d4b4e6c00 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamelength.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamelength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentgetelementsbytagnamelength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentgetelementsbytagnamelength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getElementsByTagName(tagName)" method returns a + NodeList of all the Elements with a given tagName. + + Retrieve the entire DOM document and invoke its + "getElementsByTagName(tagName)" method with tagName + equal to "strong". The method should return a NodeList + that contains 5 elements. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 +*/ +function hc_documentgetelementsbytagnamelength() { + var success; + if(checkInitialization(builder, "hc_documentgetelementsbytagnamelength") != null) return; + var doc; + var nameList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + nameList = doc.getElementsByTagName("strong"); + assertSize("documentGetElementsByTagNameLengthAssert",5,nameList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamelength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html new file mode 100644 index 0000000000..0db66cf622 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnametotallength.html @@ -0,0 +1,237 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnametotallength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentgetelementsbytagnametotallength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentgetelementsbytagnametotallength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the entire DOM document and invoke its + "getElementsByTagName(tagName)" method with tagName + equal to "*". The method should return a NodeList + that contains all the elements of the document. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function hc_documentgetelementsbytagnametotallength() { + var success; + if(checkInitialization(builder, "hc_documentgetelementsbytagnametotallength") != null) return; + var doc; + var nameList; + expectedNames = new Array(); + expectedNames[0] = "html"; + expectedNames[1] = "head"; + expectedNames[2] = "meta"; + expectedNames[3] = "title"; + expectedNames[4] = "script"; + expectedNames[5] = "script"; + expectedNames[6] = "script"; + expectedNames[7] = "body"; + expectedNames[8] = "p"; + expectedNames[9] = "em"; + expectedNames[10] = "strong"; + expectedNames[11] = "code"; + expectedNames[12] = "sup"; + expectedNames[13] = "var"; + expectedNames[14] = "acronym"; + expectedNames[15] = "p"; + expectedNames[16] = "em"; + expectedNames[17] = "strong"; + expectedNames[18] = "code"; + expectedNames[19] = "sup"; + expectedNames[20] = "var"; + expectedNames[21] = "acronym"; + expectedNames[22] = "p"; + expectedNames[23] = "em"; + expectedNames[24] = "strong"; + expectedNames[25] = "code"; + expectedNames[26] = "sup"; + expectedNames[27] = "var"; + expectedNames[28] = "acronym"; + expectedNames[29] = "p"; + expectedNames[30] = "em"; + expectedNames[31] = "strong"; + expectedNames[32] = "code"; + expectedNames[33] = "sup"; + expectedNames[34] = "var"; + expectedNames[35] = "acronym"; + expectedNames[36] = "p"; + expectedNames[37] = "em"; + expectedNames[38] = "strong"; + expectedNames[39] = "code"; + expectedNames[40] = "sup"; + expectedNames[41] = "var"; + expectedNames[42] = "acronym"; + + svgExpectedNames = new Array(); + svgExpectedNames[0] = "svg"; + svgExpectedNames[1] = "rect"; + svgExpectedNames[2] = "script"; + svgExpectedNames[3] = "head"; + svgExpectedNames[4] = "meta"; + svgExpectedNames[5] = "title"; + svgExpectedNames[6] = "body"; + svgExpectedNames[7] = "p"; + svgExpectedNames[8] = "em"; + svgExpectedNames[9] = "strong"; + svgExpectedNames[10] = "code"; + svgExpectedNames[11] = "sup"; + svgExpectedNames[12] = "var"; + svgExpectedNames[13] = "acronym"; + svgExpectedNames[14] = "p"; + svgExpectedNames[15] = "em"; + svgExpectedNames[16] = "strong"; + svgExpectedNames[17] = "code"; + svgExpectedNames[18] = "sup"; + svgExpectedNames[19] = "var"; + svgExpectedNames[20] = "acronym"; + svgExpectedNames[21] = "p"; + svgExpectedNames[22] = "em"; + svgExpectedNames[23] = "strong"; + svgExpectedNames[24] = "code"; + svgExpectedNames[25] = "sup"; + svgExpectedNames[26] = "var"; + svgExpectedNames[27] = "acronym"; + svgExpectedNames[28] = "p"; + svgExpectedNames[29] = "em"; + svgExpectedNames[30] = "strong"; + svgExpectedNames[31] = "code"; + svgExpectedNames[32] = "sup"; + svgExpectedNames[33] = "var"; + svgExpectedNames[34] = "acronym"; + svgExpectedNames[35] = "p"; + svgExpectedNames[36] = "em"; + svgExpectedNames[37] = "strong"; + svgExpectedNames[38] = "code"; + svgExpectedNames[39] = "sup"; + svgExpectedNames[40] = "var"; + svgExpectedNames[41] = "acronym"; + + var actualNames = new Array(); + + var thisElement; + var thisTag; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + nameList = doc.getElementsByTagName("*"); + for(var indexN65864 = 0;indexN65864 < nameList.length; indexN65864++) { + thisElement = nameList.item(indexN65864); + thisTag = thisElement.tagName; + + actualNames[actualNames.length] = thisTag; + + } + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEqualsListAutoCase("element", "svgTagNames",svgExpectedNames,actualNames); + + } + + else { + assertEqualsListAutoCase("element", "tagNames",expectedNames,actualNames); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnametotallength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html new file mode 100644 index 0000000000..7e2eb1d2e6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetelementsbytagnamevalue.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentgetelementsbytagnamevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentgetelementsbytagnamevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getElementsByTagName(tagName)" method returns a + NodeList of all the Elements with a given tagName + in a pre-order traversal of the tree. + + Retrieve the entire DOM document and invoke its + "getElementsByTagName(tagName)" method with tagName + equal to "strong". The method should return a NodeList + that contains 5 elements. The FOURTH item in the + list is retrieved and output. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 +*/ +function hc_documentgetelementsbytagnamevalue() { + var success; + if(checkInitialization(builder, "hc_documentgetelementsbytagnamevalue") != null) return; + var doc; + var nameList; + var nameNode; + var firstChild; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + nameList = doc.getElementsByTagName("strong"); + nameNode = nameList.item(3); + firstChild = nameNode.firstChild; + + childValue = firstChild.nodeValue; + + assertEquals("documentGetElementsByTagNameValueAssert","Jeny Oconnor",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnamevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html new file mode 100644 index 0000000000..0a4fca9cb4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetimplementation.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetimplementation</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentgetimplementation']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentgetimplementation'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the entire DOM document and invoke its + "getImplementation()" method. If contentType="text/html", + DOMImplementation.hasFeature("HTML","1.0") should be true. + Otherwise, DOMImplementation.hasFeature("XML", "1.0") + should be true. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 +*/ +function hc_documentgetimplementation() { + var success; + if(checkInitialization(builder, "hc_documentgetimplementation") != null) return; + var doc; + var docImpl; + var xmlstate; + var htmlstate; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docImpl = doc.implementation; +xmlstate = docImpl.hasFeature("XML","1.0"); +htmlstate = docImpl.hasFeature("HTML","1.0"); + + if( + + (builder.contentType == "text/html") + + ) { + assertTrue("supports_HTML_1.0",htmlstate); + + } + + else { + assertTrue("supports_XML_1.0",xmlstate); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetimplementation</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html new file mode 100644 index 0000000000..1b03a9b05f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentgetrootnode.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetrootnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentgetrootnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentgetrootnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Load a document and invoke its + "getDocumentElement()" method. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function hc_documentgetrootnode() { + var success; + if(checkInitialization(builder, "hc_documentgetrootnode") != null) return; + var doc; + var root; + var rootName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + root = doc.documentElement; + + rootName = root.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgTagName","svg",rootName); + + } + + else { + assertEqualsAutoCase("element", "docElemName","html",rootName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetrootnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html new file mode 100644 index 0000000000..ad64e33e68 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentinvalidcharacterexceptioncreateattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentinvalidcharacterexceptioncreateattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createAttribute(tagName)" method raises an + INVALID_CHARACTER_ERR DOMException if the specified + tagName contains an invalid character. + + Retrieve the entire DOM document and invoke its + "createAttribute(tagName)" method with the tagName equal + to the string "invalid^Name". Due to the invalid + character the desired EXCEPTION should be raised. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_documentinvalidcharacterexceptioncreateattribute() { + var success; + if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateattribute") != null) return; + var doc; + var createdAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + createdAttr = doc.createAttribute("invalid^Name"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html new file mode 100644 index 0000000000..55c76fce29 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateattribute1.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentinvalidcharacterexceptioncreateattribute1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentinvalidcharacterexceptioncreateattribute1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Creating an attribute with an empty name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function hc_documentinvalidcharacterexceptioncreateattribute1() { + var success; + if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateattribute1") != null) return; + var doc; + var createdAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + createdAttr = doc.createAttribute(""); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html new file mode 100644 index 0000000000..4f1418c4d3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentinvalidcharacterexceptioncreateelement']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentinvalidcharacterexceptioncreateelement'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "createElement(tagName)" method raises an + INVALID_CHARACTER_ERR DOMException if the specified + tagName contains an invalid character. + + Retrieve the entire DOM document and invoke its + "createElement(tagName)" method with the tagName equal + to the string "invalid^Name". Due to the invalid + character the desired EXCEPTION should be raised. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_documentinvalidcharacterexceptioncreateelement() { + var success; + if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateelement") != null) return; + var doc; + var badElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + badElement = doc.createElement("invalid^Name"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html new file mode 100644 index 0000000000..8919c95dae --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_documentinvalidcharacterexceptioncreateelement1.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_documentinvalidcharacterexceptioncreateelement1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_documentinvalidcharacterexceptioncreateelement1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Creating an element with an empty name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function hc_documentinvalidcharacterexceptioncreateelement1() { + var success; + if(checkInitialization(builder, "hc_documentinvalidcharacterexceptioncreateelement1") != null) return; + var doc; + var badElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + badElement = doc.createElement(""); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html new file mode 100644 index 0000000000..f558874383 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenoversion.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenoversion</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_domimplementationfeaturenoversion']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_domimplementationfeaturenoversion'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Load a document and invoke its + "getImplementation()" method. This should create a + DOMImplementation object whose "hasFeature(feature, + version)" method is invoked with version equal to "". + If the version is not specified, supporting any version + feature will cause the method to return "true". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 +* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 +*/ +function hc_domimplementationfeaturenoversion() { + var success; + if(checkInitialization(builder, "hc_domimplementationfeaturenoversion") != null) return; + var doc; + var domImpl; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + domImpl = doc.implementation; + + if( + + (builder.contentType == "text/html") + + ) { + state = domImpl.hasFeature("HTML",""); + + } + + else { + state = domImpl.hasFeature("XML",""); + + } + assertTrue("hasFeatureBlank",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenoversion</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html new file mode 100644 index 0000000000..88be6a0593 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturenull.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_domimplementationfeaturenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("hasNullString", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_domimplementationfeaturenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Load a document and invoke its + "getImplementation()" method. This should create a + DOMImplementation object whose "hasFeature(feature, + version)" method is invoked with version equal to null. + If the version is not specified, supporting any version + feature will cause the method to return "true". + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 +* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 +*/ +function hc_domimplementationfeaturenull() { + var success; + if(checkInitialization(builder, "hc_domimplementationfeaturenull") != null) return; + var doc; + var domImpl; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + domImpl = doc.implementation; + + if( + + (builder.contentType == "text/html") + + ) { + state = domImpl.hasFeature("HTML",null); +assertTrue("supports_HTML_null",state); + + } + + else { + state = domImpl.hasFeature("XML",null); +assertTrue("supports_XML_null",state); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html new file mode 100644 index 0000000000..1563804e79 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_domimplementationfeaturexml.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturexml</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_domimplementationfeaturexml']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_domimplementationfeaturexml'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the entire DOM document and invoke its + "getImplementation()" method. This should create a + DOMImplementation object whose "hasFeature(feature, + version)" method is invoked with "feature" equal to "html" or "xml". + The method should return a boolean "true". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 +*/ +function hc_domimplementationfeaturexml() { + var success; + if(checkInitialization(builder, "hc_domimplementationfeaturexml") != null) return; + var doc; + var domImpl; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + domImpl = doc.implementation; + + if( + + (builder.contentType == "text/html") + + ) { + state = domImpl.hasFeature("html","1.0"); +assertTrue("supports_html_1.0",state); + + } + + else { + state = domImpl.hasFeature("xml","1.0"); +assertTrue("supports_xml_1.0",state); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_domimplementationfeaturexml</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html new file mode 100644 index 0000000000..0328cf8c13 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementaddnewattribute.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementaddnewattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementaddnewattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementaddnewattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method adds a new attribute + to the Element + + Retrieve the last child of the last employee, then + add an attribute to it by invoking the + "setAttribute(name,value)" method. It should create + a "strong" attribute with an assigned value equal to + "value". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_elementaddnewattribute() { + var success; + if(checkInitialization(builder, "hc_elementaddnewattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(4); + testEmployee.setAttribute("lang","EN-us"); + attrValue = testEmployee.getAttribute("lang"); + assertEquals("attrValue","EN-us",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementaddnewattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html new file mode 100644 index 0000000000..0b279b88f3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementassociatedattribute.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementassociatedattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementassociatedattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementassociatedattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the first attribute from the last child of + the first employee and invoke the "getSpecified()" + method. This test is only intended to show that + Elements can actually have attributes. This test uses + the "getNamedItem(name)" method from the NamedNodeMap + interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function hc_elementassociatedattribute() { + var success; + if(checkInitialization(builder, "hc_elementassociatedattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var domesticAttr; + var specified; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(0); + attributes = testEmployee.attributes; + + domesticAttr = attributes.getNamedItem("title"); + specified = domesticAttr.specified; + + assertTrue("acronymTitleSpecified",specified); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementassociatedattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html new file mode 100644 index 0000000000..1918601671 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementchangeattributevalue.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementchangeattributevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementchangeattributevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementchangeattributevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method adds a new attribute + to the Element. If the "strong" is already present, then + its value should be changed to the new one that is in + the "value" parameter. + + Retrieve the last child of the fourth employee, then add + an attribute to it by invoking the + "setAttribute(name,value)" method. Since the name of the + used attribute("class") is already present in this + element, then its value should be changed to the new one + of the "value" parameter. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +*/ +function hc_elementchangeattributevalue() { + var success; + if(checkInitialization(builder, "hc_elementchangeattributevalue") != null) return; + var doc; + var elementList; + var testEmployee; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(3); + testEmployee.setAttribute("class","Neither"); + attrValue = testEmployee.getAttribute("class"); + assertEquals("elementChangeAttributeValueAssert","Neither",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementchangeattributevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html new file mode 100644 index 0000000000..3d9faa7d27 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementcreatenewattribute.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementcreatenewattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementcreatenewattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementcreatenewattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method adds a new + attribute to the Element. + + Retrieve first address element and add + a new attribute node to it by invoking its + "setAttributeNode(newAttr)" method. This test makes use + of the "createAttribute(name)" method from the Document + interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_elementcreatenewattribute() { + var success; + if(checkInitialization(builder, "hc_elementcreatenewattribute") != null) return; + var doc; + var elementList; + var testAddress; + var newAttribute; + var oldAttr; + var districtAttr; + var attrVal; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(0); + newAttribute = doc.createAttribute("lang"); + oldAttr = testAddress.setAttributeNode(newAttribute); + assertNull("old_attr_doesnt_exist",oldAttr); + districtAttr = testAddress.getAttributeNode("lang"); + assertNotNull("new_district_accessible",districtAttr); +attrVal = testAddress.getAttribute("lang"); + assertEquals("attr_value","",attrVal); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementcreatenewattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html new file mode 100644 index 0000000000..0bdbf285ad --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenode.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetattributenode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetattributenode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the attribute "title" from the last child + of the first "p" element and check its node name. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +*/ +function hc_elementgetattributenode() { + var success; + if(checkInitialization(builder, "hc_elementgetattributenode") != null) return; + var doc; + var elementList; + var testEmployee; + var domesticAttr; + var nodeName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(0); + domesticAttr = testEmployee.getAttributeNode("title"); + nodeName = domesticAttr.nodeName; + + assertEqualsAutoCase("attribute", "nodeName","title",nodeName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html new file mode 100644 index 0000000000..902b6e7e69 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetattributenodenull.html @@ -0,0 +1,131 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetattributenodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetattributenodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributeNode(name)" method retrieves an + attribute node by name. It should return null if the + "strong" attribute does not exist. + + Retrieve the last child of the first employee and attempt + to retrieve a non-existing attribute. The method should + return "null". The non-existing attribute to be used + is "invalidAttribute". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 +*/ +function hc_elementgetattributenodenull() { + var success; + if(checkInitialization(builder, "hc_elementgetattributenodenull") != null) return; + var doc; + var elementList; + var testEmployee; + var domesticAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(0); + domesticAttr = testEmployee.getAttributeNode("invalidAttribute"); + assertNull("elementGetAttributeNodeNullAssert",domesticAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetattributenodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html new file mode 100644 index 0000000000..6457e06429 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementempty.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementempty</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetelementempty']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetelementempty'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttribute(name)" method returns an empty + string if no value was assigned to an attribute and + no default value was given in the DTD file. + + Retrieve the last child of the last employee, then + invoke "getAttribute(name)" method, where "strong" is an + attribute without a specified or DTD default value. + The "getAttribute(name)" method should return the empty + string. This method makes use of the + "createAttribute(newAttr)" method from the Document + interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_elementgetelementempty() { + var success; + if(checkInitialization(builder, "hc_elementgetelementempty") != null) return; + var doc; + var newAttribute; + var elementList; + var testEmployee; + var domesticAttr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newAttribute = doc.createAttribute("lang"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(3); + domesticAttr = testEmployee.setAttributeNode(newAttribute); + attrValue = testEmployee.getAttribute("lang"); + assertEquals("elementGetElementEmptyAssert","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementempty</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html new file mode 100644 index 0000000000..311b84b52b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagname.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetelementsbytagname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetelementsbytagname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method returns a list +of all descendant Elements with the given tag name. +Test for an empty list. + +Create a NodeList of all the descendant elements +using the string "noMatch" as the tagName. +The method should return a NodeList whose length is +"0" since there are not any descendant elements +that match the given tag name. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function hc_elementgetelementsbytagname() { + var success; + if(checkInitialization(builder, "hc_elementgetelementsbytagname") != null) return; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + assertSize("elementGetElementsByTagNameAssert",5,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html new file mode 100644 index 0000000000..efbaa7f7dd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnameaccessnodelist.html @@ -0,0 +1,160 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnameaccessnodelist</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetelementsbytagnameaccessnodelist']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetelementsbytagnameaccessnodelist'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method returns a list +of all descendant Elements in the order the children +were encountered in a pre order traversal of the element +tree. + +Create a NodeList of all the descendant elements +using the string "p" as the tagName. +The method should return a NodeList whose length is +"5" in the order the children were encountered. +Access the FOURTH element in the NodeList. The FOURTH +element, the first or second should be an "em" node with +the content "EMP0004". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_elementgetelementsbytagnameaccessnodelist() { + var success; + if(checkInitialization(builder, "hc_elementgetelementsbytagnameaccessnodelist") != null) return; + var doc; + var elementList; + var testEmployee; + var firstC; + var childName; + var nodeType; + var employeeIDNode; + var employeeID; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + testEmployee = elementList.item(3); + firstC = testEmployee.firstChild; + + nodeType = firstC.nodeType; + + + while( + (3 == nodeType) + ) { + firstC = firstC.nextSibling; + + nodeType = firstC.nodeType; + + + } +childName = firstC.nodeName; + + assertEqualsAutoCase("element", "childName","em",childName); + employeeIDNode = firstC.firstChild; + + employeeID = employeeIDNode.nodeValue; + + assertEquals("employeeID","EMP0004",employeeID); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnameaccessnodelist</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html new file mode 100644 index 0000000000..9c8994241f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamenomatch.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamenomatch</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetelementsbytagnamenomatch']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetelementsbytagnamenomatch'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method returns a list +of all descendant Elements with the given tag name. + +Create a NodeList of all the descendant elements +using the string "employee" as the tagName. +The method should return a NodeList whose length is +"5". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function hc_elementgetelementsbytagnamenomatch() { + var success; + if(checkInitialization(builder, "hc_elementgetelementsbytagnamenomatch") != null) return; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("noMatch"); + assertSize("elementGetElementsByTagNameNoMatchNoMatchAssert",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamenomatch</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html new file mode 100644 index 0000000000..ae4eced5bb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgetelementsbytagnamespecialvalue.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamespecialvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgetelementsbytagnamespecialvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgetelementsbytagnamespecialvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getElementsByTagName(name)" method may use the +special value "*" to match all tags in the element +tree. + +Create a NodeList of all the descendant elements +of the last employee by using the special value "*". +The method should return all the descendant children(6) +in the order the children were encountered. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D +*/ +function hc_elementgetelementsbytagnamespecialvalue() { + var success; + if(checkInitialization(builder, "hc_elementgetelementsbytagnamespecialvalue") != null) return; + var doc; + var elementList; + var lastEmployee; + var lastempList; + var child; + var childName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "em"; + expectedResult[1] = "strong"; + expectedResult[2] = "code"; + expectedResult[3] = "sup"; + expectedResult[4] = "var"; + expectedResult[5] = "acronym"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + lastEmployee = elementList.item(4); + lastempList = lastEmployee.getElementsByTagName("*"); + for(var indexN65639 = 0;indexN65639 < lastempList.length; indexN65639++) { + child = lastempList.item(indexN65639); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsListAutoCase("element", "tagNames",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamespecialvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html new file mode 100644 index 0000000000..863ec7ebcd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementgettagname.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgettagname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementgettagname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementgettagname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Invoke the "getTagName()" method one the + root node. The value returned should be "html" or "svg". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function hc_elementgettagname() { + var success; + if(checkInitialization(builder, "hc_elementgettagname") != null) return; + var doc; + var root; + var tagname; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + root = doc.documentElement; + + tagname = root.tagName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgTagname","svg",tagname); + + } + + else { + assertEqualsAutoCase("element", "tagname","html",tagname); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgettagname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html new file mode 100644 index 0000000000..cb0d6b54c6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementinuseattributeerr.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinuseattributeerr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementinuseattributeerr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementinuseattributeerr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method raises an + "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" + is already an attribute of another element. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=244 +*/ +function hc_elementinuseattributeerr() { + var success; + if(checkInitialization(builder, "hc_elementinuseattributeerr") != null) return; + var doc; + var newAttribute; + var addressElementList; + var testAddress; + var newElement; + var attrAddress; + var appendedChild; + var setAttr1; + var setAttr2; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressElementList = doc.getElementsByTagName("body"); + testAddress = addressElementList.item(0); + newElement = doc.createElement("p"); + appendedChild = testAddress.appendChild(newElement); + newAttribute = doc.createAttribute("title"); + setAttr1 = newElement.setAttributeNode(newAttribute); + + { + success = false; + try { + setAttr2 = testAddress.setAttributeNode(newAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("throw_INUSE_ATTRIBUTE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinuseattributeerr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html new file mode 100644 index 0000000000..d25fc82ab1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementinvalidcharacterexception']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementinvalidcharacterexception'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttribute(name,value)" method raises an + "INVALID_CHARACTER_ERR DOMException if the specified + name contains an invalid character. + + Retrieve the last child of the first employee and + call its "setAttribute(name,value)" method with + "strong" containing an invalid character. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_elementinvalidcharacterexception() { + var success; + if(checkInitialization(builder, "hc_elementinvalidcharacterexception") != null) return; + var doc; + var elementList; + var testAddress; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(0); + + { + success = false; + try { + testAddress.setAttribute("invalid^Name","value"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html new file mode 100644 index 0000000000..494c75e0df --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementinvalidcharacterexception1.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementinvalidcharacterexception1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementinvalidcharacterexception1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Calling Element.setAttribute with an empty name will cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function hc_elementinvalidcharacterexception1() { + var success; + if(checkInitialization(builder, "hc_elementinvalidcharacterexception1") != null) return; + var doc; + var elementList; + var testAddress; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(0); + + { + success = false; + try { + testAddress.setAttribute("","value"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html new file mode 100644 index 0000000000..8e71f8f9cc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementnormalize']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementnormalize'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Append a couple of text nodes to the first sup element, normalize the +document element and check that the element has been normalized. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=546 +*/ +function hc_elementnormalize() { + var success; + if(checkInitialization(builder, "hc_elementnormalize") != null) return; + var doc; + var root; + var elementList; + var testName; + var firstChild; + var childValue; + var textNode; + var retNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("sup"); + testName = elementList.item(0); + textNode = doc.createTextNode(""); + retNode = testName.appendChild(textNode); + textNode = doc.createTextNode(",000"); + retNode = testName.appendChild(textNode); + root = doc.documentElement; + + root.normalize(); + elementList = doc.getElementsByTagName("sup"); + testName = elementList.item(0); + firstChild = testName.firstChild; + + childValue = firstChild.nodeValue; + + assertEquals("elementNormalizeAssert","56,000,000",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html new file mode 100644 index 0000000000..92013976a9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementnormalize2.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize2</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementnormalize2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementnormalize2'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Add an empty text node to an existing attribute node, normalize the containing element +and check that the attribute node has eliminated the empty text. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=482 +*/ +function hc_elementnormalize2() { + var success; + if(checkInitialization(builder, "hc_elementnormalize2") != null) return; + var doc; + var root; + var elementList; + var element; + var firstChild; + var secondChild; + var childValue; + var emptyText; + var attrNode; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + root = doc.documentElement; + + emptyText = doc.createTextNode(""); + elementList = root.getElementsByTagName("acronym"); + element = elementList.item(0); + attrNode = element.getAttributeNode("title"); + retval = attrNode.appendChild(emptyText); + element.normalize(); + attrNode = element.getAttributeNode("title"); + firstChild = attrNode.firstChild; + + childValue = firstChild.nodeValue; + + assertEquals("firstChild","Yes",childValue); + secondChild = firstChild.nextSibling; + + assertNull("secondChildNull",secondChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html new file mode 100644 index 0000000000..3795e44ba6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementnotfounderr.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnotfounderr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementnotfounderr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementnotfounderr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method raises a + NOT_FOUND_ERR DOMException if the "oldAttr" attribute + is not an attribute of the element. + + Retrieve the last employee and attempt to remove + a non existing attribute node. This should cause the + intended exception to be raised. This test makes use + of the "createAttribute(name)" method from the Document + interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_elementnotfounderr() { + var success; + if(checkInitialization(builder, "hc_elementnotfounderr") != null) return; + var doc; + var oldAttribute; + var addressElementList; + var testAddress; + var attrAddress; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressElementList = doc.getElementsByTagName("acronym"); + testAddress = addressElementList.item(4); + oldAttribute = doc.createAttribute("title"); + + { + success = false; + try { + attrAddress = testAddress.removeAttributeNode(oldAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnotfounderr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html new file mode 100644 index 0000000000..0561851a39 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattribute.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementremoveattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementremoveattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttribute(name)" removes an attribute by name. + If the attribute has a default value, it is immediately + replaced. However, there is no default values in the HTML + compatible tests, so its value is "". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function hc_elementremoveattribute() { + var success; + if(checkInitialization(builder, "hc_elementremoveattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(3); + testEmployee.removeAttribute("class"); + attrValue = testEmployee.getAttribute("class"); + assertEquals("attrValue","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html new file mode 100644 index 0000000000..8d3e7482c1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributeaftercreate.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributeaftercreate</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementremoveattributeaftercreate']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementremoveattributeaftercreate'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method removes the + specified attribute. + + Retrieve the last child of the third employee, add a + new "lang" attribute to it and then try to remove it. + To verify that the node was removed use the + "getNamedItem(name)" method from the NamedNodeMap + interface. It also uses the "getAttributes()" method + from the Node interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_elementremoveattributeaftercreate() { + var success; + if(checkInitialization(builder, "hc_elementremoveattributeaftercreate") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var attributes; + var districtAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("lang"); + districtAttr = testEmployee.setAttributeNode(newAttribute); + districtAttr = testEmployee.removeAttributeNode(newAttribute); + attributes = testEmployee.attributes; + + districtAttr = attributes.getNamedItem("lang"); + assertNull("removed_item_null",districtAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributeaftercreate</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html new file mode 100644 index 0000000000..4883111bf9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementremoveattributenode.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributenode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementremoveattributenode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementremoveattributenode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeAttributeNode(oldAttr)" method returns the + node that was removed. + + Retrieve the last child of the third employee and + remove its "class" Attr node. The method should + return the old attribute node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 +*/ +function hc_elementremoveattributenode() { + var success; + if(checkInitialization(builder, "hc_elementremoveattributenode") != null) return; + var doc; + var elementList; + var testEmployee; + var streetAttr; + var removedAttr; + var removedValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + streetAttr = testEmployee.getAttributeNode("class"); + removedAttr = testEmployee.removeAttributeNode(streetAttr); + assertNotNull("removedAttrNotNull",removedAttr); +removedValue = removedAttr.value; + + assertEquals("elementRemoveAttributeNodeAssert","No",removedValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributenode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html new file mode 100644 index 0000000000..c939b6a755 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceattributewithself.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceattributewithself</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementreplaceattributewithself']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementreplaceattributewithself'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +This test calls setAttributeNode to replace an attribute with itself. +Since the node is not an attribute of another Element, it would +be inappropriate to throw an INUSE_ATTRIBUTE_ERR. + +This test was derived from elementinuserattributeerr which +inadvertanly made this test. + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function hc_elementreplaceattributewithself() { + var success; + if(checkInitialization(builder, "hc_elementreplaceattributewithself") != null) return; + var doc; + var elementList; + var testEmployee; + var streetAttr; + var replacedAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + streetAttr = testEmployee.getAttributeNode("class"); + replacedAttr = testEmployee.setAttributeNode(streetAttr); + assertSame("replacedAttr",streetAttr,replacedAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceattributewithself</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html new file mode 100644 index 0000000000..6f95395ba8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattribute.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementreplaceexistingattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementreplaceexistingattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method adds a new + attribute to the Element. If the "newAttr" Attr node is + already present in this element, it should replace the + existing one. + + Retrieve the last child of the third employee and add a + new attribute node by invoking the "setAttributeNode(new + Attr)" method. The new attribute node to be added is + "class", which is already present in this element. The + method should replace the existing Attr node with the + new one. This test uses the "createAttribute(name)" + method from the Document interface. + +* @author Curt Arnold +*/ +function hc_elementreplaceexistingattribute() { + var success; + if(checkInitialization(builder, "hc_elementreplaceexistingattribute") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var strong; + var setAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("class"); + setAttr = testEmployee.setAttributeNode(newAttribute); + strong = testEmployee.getAttribute("class"); + assertEquals("replacedValue","",strong); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html new file mode 100644 index 0000000000..95684dc692 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementreplaceexistingattributegevalue.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattributegevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementreplaceexistingattributegevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementreplaceexistingattributegevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +If the "setAttributeNode(newAttr)" method replaces an +existing Attr node with the same name, then it should +return the previously existing Attr node. + +Retrieve the last child of the third employee and add a +new attribute node. The new attribute node is "class", +which is already present in this Element. The method +should return the existing Attr node(old "class" Attr). +This test uses the "createAttribute(name)" method +from the Document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +*/ +function hc_elementreplaceexistingattributegevalue() { + var success; + if(checkInitialization(builder, "hc_elementreplaceexistingattributegevalue") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var streetAttr; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("class"); + streetAttr = testEmployee.setAttributeNode(newAttribute); + assertNotNull("previousAttrNotNull",streetAttr); +value = streetAttr.value; + + assertEquals("previousAttrValue","No",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceexistingattributegevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html new file mode 100644 index 0000000000..c1186ce620 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveallattributes.html @@ -0,0 +1,160 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveallattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementretrieveallattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementretrieveallattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a list of all the attributes of the last child + of the first "p" element by using the "getAttributes()" + method. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 +*/ +function hc_elementretrieveallattributes() { + var success; + if(checkInitialization(builder, "hc_elementretrieveallattributes") != null) return; + var doc; + var addressList; + var testAddress; + var attributes; + var attribute; + var attributeName; + var actual = new Array(); + + htmlExpected = new Array(); + htmlExpected[0] = "title"; + + expected = new Array(); + expected[0] = "title"; + expected[1] = "dir"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + addressList = doc.getElementsByTagName("acronym"); + testAddress = addressList.item(0); + attributes = testAddress.attributes; + + for(var indexN65643 = 0;indexN65643 < attributes.length; indexN65643++) { + attribute = attributes.item(indexN65643); + attributeName = attribute.nodeName; + + actual[actual.length] = attributeName; + + } + + if( + + (builder.contentType == "text/html") + + ) { + assertEqualsCollection("htmlAttributeNames",toLowerArray(htmlExpected),toLowerArray(actual)); + + } + + else { + assertEqualsCollection("attributeNames",toLowerArray(expected),toLowerArray(actual)); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveallattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html new file mode 100644 index 0000000000..2afcab28f7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrieveattrvalue.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveattrvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementretrieveattrvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementretrieveattrvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttribute(name)" method returns an attribute + value by name. + + Retrieve the second address element, then + invoke the 'getAttribute("class")' method. This should + return the value of the attribute("No"). + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 +*/ +function hc_elementretrieveattrvalue() { + var success; + if(checkInitialization(builder, "hc_elementretrieveattrvalue") != null) return; + var doc; + var elementList; + var testAddress; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(2); + attrValue = testAddress.getAttribute("class"); + assertEquals("attrValue","No",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrieveattrvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html new file mode 100644 index 0000000000..11e75b0cf9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementretrievetagname.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrievetagname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementretrievetagname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementretrievetagname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getElementsByTagName()" method returns a NodeList + of all descendant elements with a given tagName. + + Invoke the "getElementsByTagName()" method and create + a NodeList of "code" elements. Retrieve the second + "code" element in the list and return the NodeName. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 +*/ +function hc_elementretrievetagname() { + var success; + if(checkInitialization(builder, "hc_elementretrievetagname") != null) return; + var doc; + var elementList; + var testEmployee; + var strong; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("code"); + testEmployee = elementList.item(1); + strong = testEmployee.nodeName; + + assertEqualsAutoCase("element", "nodename","code",strong); + strong = testEmployee.tagName; + + assertEqualsAutoCase("element", "tagname","code",strong); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementretrievetagname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html new file mode 100644 index 0000000000..42d08b0bc9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementsetattributenodenull.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementsetattributenodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementsetattributenodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementsetattributenodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method returns the + null value if no previously existing Attr node with the + same name was replaced. + + Retrieve the last child of the third employee and add a + new attribute to it. The new attribute node added is + "lang", which is not part of this Element. The + method should return the null value. + This test uses the "createAttribute(name)" + method from the Document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_elementsetattributenodenull() { + var success; + if(checkInitialization(builder, "hc_elementsetattributenodenull") != null) return; + var doc; + var elementList; + var testEmployee; + var newAttribute; + var districtAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + newAttribute = doc.createAttribute("lang"); + districtAttr = testEmployee.setAttributeNode(newAttribute); + assertNull("elementSetAttributeNodeNullAssert",districtAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementsetattributenodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html new file mode 100644 index 0000000000..d293a462ed --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_elementwrongdocumenterr.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_elementwrongdocumenterr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_elementwrongdocumenterr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setAttributeNode(newAttr)" method raises an + "WRONG_DOCUMENT_ERR DOMException if the "newAttr" + was created from a different document than the one that + created this document. + + Retrieve the last employee and attempt to set a new + attribute node for its "employee" element. The new + attribute was created from a document other than the + one that created this element, therefore a + WRONG_DOCUMENT_ERR DOMException should be raised. + + This test uses the "createAttribute(newAttr)" method + from the Document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_elementwrongdocumenterr() { + var success; + if(checkInitialization(builder, "hc_elementwrongdocumenterr") != null) return; + var doc1; + var doc2; + var newAttribute; + var addressElementList; + var testAddress; + var attrAddress; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "hc_staff"); + newAttribute = doc2.createAttribute("newAttribute"); + addressElementList = doc1.getElementsByTagName("acronym"); + testAddress = addressElementList.item(4); + + { + success = false; + try { + attrAddress = testAddress.setAttributeNode(newAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementwrongdocumenterr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc1" src="files/hc_staff.html"></iframe> +<br> +<iframe name="doc2" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html new file mode 100644 index 0000000000..0393296cef --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_entitiesremovenameditem1.html @@ -0,0 +1,153 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiesremovenameditem1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_entitiesremovenameditem1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_entitiesremovenameditem1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An attempt to add remove an entity should result in a NO_MODIFICATION_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +*/ +function hc_entitiesremovenameditem1() { + var success; + if(checkInitialization(builder, "hc_entitiesremovenameditem1") != null) return; + var doc; + var entities; + var docType; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); + + { + success = false; + try { + retval = entities.removeNamedItem("alpha"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(builder.contentType, "text/html", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiesremovenameditem1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html new file mode 100644 index 0000000000..72673927c8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_entitiessetnameditem1.html @@ -0,0 +1,164 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiessetnameditem1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_entitiessetnameditem1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_entitiessetnameditem1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An attempt to add an element to the named node map returned by entities should +result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +*/ +function hc_entitiessetnameditem1() { + var success; + if(checkInitialization(builder, "hc_entitiessetnameditem1") != null) return; + var doc; + var entities; + var docType; + var retval; + var elem; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +elem = doc.createElement("br"); + + try { + retval = entities.setNamedItem(elem); + fail("throw_HIER_OR_NO_MOD_ERR"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* HIERARCHY_REQUEST_ERR */ 3 : + break; + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(builder.contentType, "text/html", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_entitiessetnameditem1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html new file mode 100644 index 0000000000..858f1c5242 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapchildnoderange.html @@ -0,0 +1,157 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapchildnoderange</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapchildnoderange']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapchildnoderange'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a NamedNodeMap object from the attributes of the + last child of the third "p" element and traverse the + list from index 0 thru length -1. All indices should + be valid. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250 +*/ +function hc_namednodemapchildnoderange() { + var success; + if(checkInitialization(builder, "hc_namednodemapchildnoderange") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var child; + var strong; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + length = attributes.length; + + + if( + + (builder.contentType == "text/html") + + ) { + assertEquals("htmlLength",2,length); + + } + + else { + assertEquals("length",3,length); + child = attributes.item(2); + assertNotNull("attr2",child); + + } + child = attributes.item(0); + assertNotNull("attr0",child); +child = attributes.item(1); + assertNotNull("attr1",child); +child = attributes.item(3); + assertNull("attr3",child); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapchildnoderange</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html new file mode 100644 index 0000000000..52466ead79 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapgetnameditem.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapgetnameditem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapgetnameditem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapgetnameditem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second "p" element and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getNamedItem(name)" + method is done with name="title". This should result + in the title Attr node being returned. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +*/ +function hc_namednodemapgetnameditem() { + var success; + if(checkInitialization(builder, "hc_namednodemapgetnameditem") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var domesticAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + domesticAttr = attributes.getNamedItem("title"); + attrName = domesticAttr.nodeName; + + assertEqualsAutoCase("attribute", "nodeName","title",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapgetnameditem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html new file mode 100644 index 0000000000..cfb10a5c45 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapinuseattributeerr.html @@ -0,0 +1,155 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapinuseattributeerr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapinuseattributeerr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapinuseattributeerr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "setNamedItem(arg)" method raises a +INUSE_ATTRIBUTE_ERR DOMException if "arg" is an +Attr that is already in an attribute of another Element. + +Create a NamedNodeMap object from the attributes of the +last child of the third employee and attempt to add +an attribute that is already being used by the first +employee. This should raise the desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_namednodemapinuseattributeerr() { + var success; + if(checkInitialization(builder, "hc_namednodemapinuseattributeerr") != null) return; + var doc; + var elementList; + var firstNode; + var testNode; + var attributes; + var domesticAttr; + var setAttr; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + firstNode = elementList.item(0); + domesticAttr = doc.createAttribute("title"); + domesticAttr.value = "Yα"; + + setAttr = firstNode.setAttributeNode(domesticAttr); + elementList = doc.getElementsByTagName("acronym"); + testNode = elementList.item(2); + attributes = testNode.attributes; + + + { + success = false; + try { + setNode = attributes.setNamedItem(domesticAttr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("throw_INUSE_ATTRIBUTE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapinuseattributeerr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html new file mode 100644 index 0000000000..75585a0b06 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnotfounderr.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnotfounderr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapnotfounderr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapnotfounderr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeNamedItem(name)" method raises a + NOT_FOUND_ERR DOMException if there is not a node + named "strong" in the map. + + Create a NamedNodeMap object from the attributes of the + last child of the third employee and attempt to remove + the "lang" attribute. There is not a node named + "lang" in the list and therefore the desired + exception should be raised. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_namednodemapnotfounderr() { + var success; + if(checkInitialization(builder, "hc_namednodemapnotfounderr") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + + { + success = false; + try { + removedNode = attributes.removeNamedItem("lang"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnotfounderr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html new file mode 100644 index 0000000000..ec88b4f4ad --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapnumberofnodes.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnumberofnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapnumberofnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapnumberofnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second "p" element and evaluate Node.attributes.length. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250 +*/ +function hc_namednodemapnumberofnodes() { + var success; + if(checkInitialization(builder, "hc_namednodemapnumberofnodes") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + length = attributes.length; + + + if( + + (builder.contentType == "text/html") + + ) { + assertEquals("htmlLength",2,length); + + } + + else { + assertEquals("length",3,length); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapnumberofnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html new file mode 100644 index 0000000000..142fb0e715 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapremovenameditem.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapremovenameditem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapremovenameditem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapremovenameditem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeNamedItem(name)" method removes a node + specified by name. + + Retrieve the third employee and create a NamedNodeMap + object of the attributes of the last child. Once the + list is created invoke the "removeNamedItem(name)" + method with name="class". This should result + in the removal of the specified attribute. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function hc_namednodemapremovenameditem() { + var success; + if(checkInitialization(builder, "hc_namednodemapremovenameditem") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var streetAttr; + var specified; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(2); + attributes = testAddress.attributes; + + removedNode = attributes.removeNamedItem("class"); + streetAttr = attributes.getNamedItem("class"); + assertNull("isnull",streetAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapremovenameditem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html new file mode 100644 index 0000000000..73c964f331 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnattrnode.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnattrnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapreturnattrnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapreturnattrnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second p element and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getNamedItem(name)" + method is done with name="class". This should result + in the method returning an Attr node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +*/ +function hc_namednodemapreturnattrnode() { + var success; + if(checkInitialization(builder, "hc_namednodemapreturnattrnode") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var streetAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + streetAttr = attributes.getNamedItem("class"); + assertInstanceOf("typeAssert","Attr",streetAttr); +attrName = streetAttr.nodeName; + + assertEqualsAutoCase("attribute", "nodeName","class",attrName); + attrName = streetAttr.name; + + assertEqualsAutoCase("attribute", "name","class",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnattrnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html new file mode 100644 index 0000000000..1f45319324 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnfirstitem.html @@ -0,0 +1,166 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnfirstitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapreturnfirstitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapreturnfirstitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "item(index)" method returns the indexth item in + the map(test for first item). + + Retrieve the second "acronym" get the NamedNodeMap of the attributes. Since the + DOM does not specify an order of these nodes the contents + of the FIRST node can contain either "title", "class" or "dir". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 +*/ +function hc_namednodemapreturnfirstitem() { + var success; + if(checkInitialization(builder, "hc_namednodemapreturnfirstitem") != null) return; + var doc; + var elementList; + var testAddress; + var attributes; + var child; + var nodeName; + htmlExpected = new Array(); + htmlExpected[0] = "title"; + htmlExpected[1] = "class"; + + expected = new Array(); + expected[0] = "title"; + expected[1] = "class"; + expected[2] = "dir"; + + var actual = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(1); + attributes = testAddress.attributes; + + for(var indexN65648 = 0;indexN65648 < attributes.length; indexN65648++) { + child = attributes.item(indexN65648); + nodeName = child.nodeName; + + actual[actual.length] = nodeName; + + } + + if( + + (builder.contentType == "text/html") + + ) { + assertEqualsCollection("attrName_html",toLowerArray(htmlExpected),toLowerArray(actual)); + + } + + else { + assertEqualsCollection("attrName",expected,actual); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnfirstitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html new file mode 100644 index 0000000000..1492eecda9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnlastitem.html @@ -0,0 +1,168 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnlastitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapreturnlastitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapreturnlastitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "item(index)" method returns the indexth item in + the map(test for last item). + + Retrieve the second "acronym" and get the attribute name. Since the + DOM does not specify an order of these nodes the contents + of the LAST node can contain either "title" or "class". + The test should return "true" if the LAST node is either + of these values. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 +*/ +function hc_namednodemapreturnlastitem() { + var success; + if(checkInitialization(builder, "hc_namednodemapreturnlastitem") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var child; + var nodeName; + htmlExpected = new Array(); + htmlExpected[0] = "title"; + htmlExpected[1] = "class"; + + expected = new Array(); + expected[0] = "title"; + expected[1] = "class"; + expected[2] = "dir"; + + var actual = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + for(var indexN65648 = 0;indexN65648 < attributes.length; indexN65648++) { + child = attributes.item(indexN65648); + nodeName = child.nodeName; + + actual[actual.length] = nodeName; + + } + + if( + + (builder.contentType == "text/html") + + ) { + assertEqualsCollection("attrName_html",toLowerArray(htmlExpected),toLowerArray(actual)); + + } + + else { + assertEqualsCollection("attrName",expected,actual); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnlastitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html new file mode 100644 index 0000000000..b5b747f633 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapreturnnull.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapreturnnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapreturnnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNamedItem(name)" method returns null of the + specified name did not identify any node in the map. + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getNamedItem(name)" + method is done with name="lang". This name does not + match any names in the list therefore the method should + return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_namednodemapreturnnull() { + var success; + if(checkInitialization(builder, "hc_namednodemapreturnnull") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var districtNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + districtNode = attributes.getNamedItem("lang"); + assertNull("langAttrNull",districtNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapreturnnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html new file mode 100644 index 0000000000..a8d6f858bd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditem.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapsetnameditem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapsetnameditem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second "p" element and create a NamedNodeMap + object from the attributes of the last child by + invoking the "getAttributes()" method. Once the + list is created an invocation of the "setNamedItem(arg)" + method is done with arg=newAttr, where newAttr is a + new Attr Node previously created. The "setNamedItem(arg)" + method should add then new node to the NamedNodeItem + object by using its "nodeName" attribute("lang'). + This node is then retrieved using the "getNamedItem(name)" + method. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_namednodemapsetnameditem() { + var success; + if(checkInitialization(builder, "hc_namednodemapsetnameditem") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var districtNode; + var attrName; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(1); + newAttribute = doc.createAttribute("lang"); + attributes = testAddress.attributes; + + setNode = attributes.setNamedItem(newAttribute); + districtNode = attributes.getNamedItem("lang"); + attrName = districtNode.nodeName; + + assertEqualsAutoCase("attribute", "nodeName","lang",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html new file mode 100644 index 0000000000..8276f250be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemreturnvalue.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemreturnvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapsetnameditemreturnvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapsetnameditemreturnvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "setNamedItem(arg)" method replaces an already + existing node with the same name then the already + existing node is returned. + + Retrieve the third employee and create a NamedNodeMap + object from the attributes of the last child by + invoking the "getAttributes()" method. Once the + list is created an invocation of the "setNamedItem(arg)" + method is done with arg=newAttr, where newAttr is a + new Attr Node previously created and whose node name + already exists in the map. The "setNamedItem(arg)" + method should replace the already existing node with + the new one and return the existing node. + This test uses the "createAttribute(name)" method from + the document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function hc_namednodemapsetnameditemreturnvalue() { + var success; + if(checkInitialization(builder, "hc_namednodemapsetnameditemreturnvalue") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var newNode; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(2); + newAttribute = doc.createAttribute("class"); + attributes = testAddress.attributes; + + newNode = attributes.setNamedItem(newAttribute); + assertNotNull("previousAttrNotNull",newNode); +attrValue = newNode.nodeValue; + + assertEquals("previousAttrValue","No",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemreturnvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html new file mode 100644 index 0000000000..5746b7dcbf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemthatexists.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemthatexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapsetnameditemthatexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapsetnameditemthatexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the node to be added by the "setNamedItem(arg)" method + already exists in the NamedNodeMap, it is replaced by + the new one. + + Retrieve the second employee and create a NamedNodeMap + object from the attributes of the last child by + invoking the "getAttributes()" method. Once the + list is created an invocation of the "setNamedItem(arg)" + method is done with arg=newAttr, where newAttr is a + new Attr Node previously created and whose node name + already exists in the map. The "setNamedItem(arg)" + method should replace the already existing node with + the new one. + This node is then retrieved using the "getNamedItem(name)" + method. This test uses the "createAttribute(name)" + method from the document interface + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function hc_namednodemapsetnameditemthatexists() { + var success; + if(checkInitialization(builder, "hc_namednodemapsetnameditemthatexists") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var districtNode; + var attrValue; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(1); + newAttribute = doc.createAttribute("class"); + attributes = testAddress.attributes; + + setNode = attributes.setNamedItem(newAttribute); + districtNode = attributes.getNamedItem("class"); + attrValue = districtNode.nodeValue; + + assertEquals("namednodemapSetNamedItemThatExistsAssert","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemthatexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html new file mode 100644 index 0000000000..a8deb0e60c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapsetnameditemwithnewvalue.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemwithnewvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapsetnameditemwithnewvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapsetnameditemwithnewvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "setNamedItem(arg)" method does not replace an + existing node with the same name then it returns null. + + Retrieve the third employee and create a NamedNodeMap + object from the attributes of the last child. + Once the list is created the "setNamedItem(arg)" method + is invoked with arg=newAttr, where newAttr is a + newly created Attr Node and whose node name + already exists in the map. The "setNamedItem(arg)" + method should add the new node and return null. + This test uses the "createAttribute(name)" method from + the document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 +*/ +function hc_namednodemapsetnameditemwithnewvalue() { + var success; + if(checkInitialization(builder, "hc_namednodemapsetnameditemwithnewvalue") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddress = elementList.item(2); + newAttribute = doc.createAttribute("lang"); + attributes = testAddress.attributes; + + newNode = attributes.setNamedItem(newAttribute); + assertNull("prevValueNull",newNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapsetnameditemwithnewvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html new file mode 100644 index 0000000000..cbdc58bdd3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_namednodemapwrongdocumenterr.html @@ -0,0 +1,167 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_namednodemapwrongdocumenterr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_namednodemapwrongdocumenterr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNamedItem(arg)" method raises a + WRONG_DOCUMENT_ERR DOMException if "arg" was created + from a different document than the one that created + the NamedNodeMap. + + Create a NamedNodeMap object from the attributes of the + last child of the third employee and attempt to add + another Attr node to it that was created from a + different DOM document. This should raise the desired + exception. This method uses the "createAttribute(name)" + method from the Document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_namednodemapwrongdocumenterr() { + var success; + if(checkInitialization(builder, "hc_namednodemapwrongdocumenterr") != null) return; + var doc1; + var doc2; + var elementList; + var testAddress; + var attributes; + var newAttribute; + var strong; + var setNode; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "hc_staff"); + elementList = doc1.getElementsByTagName("acronym"); + testAddress = elementList.item(2); + newAttribute = doc2.createAttribute("newAttribute"); + attributes = testAddress.attributes; + + + { + success = false; + try { + setNode = attributes.setNamedItem(newAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_namednodemapwrongdocumenterr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc1" src="files/hc_staff.html"></iframe> +<br> +<iframe name="doc2" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html new file mode 100644 index 0000000000..1608ac4f80 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchild.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second "p" and append a "br" Element + node to the list of children. The last node in the list + is then retrieved and its NodeName examined. The + "getNodeName()" method should return "br". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeappendchild() { + var success; + if(checkInitialization(builder, "hc_nodeappendchild") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var createdNode; + var lchild; + var childName; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + createdNode = doc.createElement("br"); + appendedChild = employeeNode.appendChild(createdNode); + lchild = employeeNode.lastChild; + + childName = lchild.nodeName; + + assertEqualsAutoCase("element", "nodeName","br",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html new file mode 100644 index 0000000000..b34566d8a1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildchildexists.html @@ -0,0 +1,176 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildchildexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchildchildexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchildchildexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is already in the tree, it is first + removed before the new one is appended. + + Retrieve the "em" second employee and + append the first child to the end of the list. After + the "appendChild(newChild)" method is invoked the first + child should be the one that was second and the last + child should be the one that was first. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodeappendchildchildexists() { + var success; + if(checkInitialization(builder, "hc_nodeappendchildchildexists") != null) return; + var doc; + var elementList; + var childList; + var childNode; + var newChild; + var memberNode; + var memberName; + var refreshedActual = new Array(); + + var actual = new Array(); + + var nodeType; + expected = new Array(); + expected[0] = "strong"; + expected[1] = "code"; + expected[2] = "sup"; + expected[3] = "var"; + expected[4] = "acronym"; + expected[5] = "em"; + + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + childNode = elementList.item(1); + childList = childNode.getElementsByTagName("*"); + newChild = childList.item(0); + appendedChild = childNode.appendChild(newChild); + for(var indexN65669 = 0;indexN65669 < childList.length; indexN65669++) { + memberNode = childList.item(indexN65669); + memberName = memberNode.nodeName; + + actual[actual.length] = memberName; + + } + assertEqualsListAutoCase("element", "liveByTagName",expected,actual); + childList = childNode.childNodes; + + for(var indexN65692 = 0;indexN65692 < childList.length; indexN65692++) { + memberNode = childList.item(indexN65692); + nodeType = memberNode.nodeType; + + + if( + (1 == nodeType) + ) { + memberName = memberNode.nodeName; + + refreshedActual[refreshedActual.length] = memberName; + + } + + } + assertEqualsListAutoCase("element", "refreshedChildNodes",expected,refreshedActual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildchildexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html new file mode 100644 index 0000000000..b59a5cf98d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchilddocfragment.html @@ -0,0 +1,174 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchilddocfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchilddocfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchilddocfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is a DocumentFragment object then + all its content is added to the child list of this node. + + Create and populate a new DocumentFragment object and + append it to the second employee. After the + "appendChild(newChild)" method is invoked retrieve the + new nodes at the end of the list, they should be the + two Element nodes from the DocumentFragment. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeappendchilddocfragment() { + var success; + if(checkInitialization(builder, "hc_nodeappendchilddocfragment") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var newdocFragment; + var newChild1; + var newChild2; + var child; + var childName; + var result = new Array(); + + var appendedChild; + var nodeType; + expected = new Array(); + expected[0] = "em"; + expected[1] = "strong"; + expected[2] = "code"; + expected[3] = "sup"; + expected[4] = "var"; + expected[5] = "acronym"; + expected[6] = "br"; + expected[7] = "b"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + newdocFragment = doc.createDocumentFragment(); + newChild1 = doc.createElement("br"); + newChild2 = doc.createElement("b"); + appendedChild = newdocFragment.appendChild(newChild1); + appendedChild = newdocFragment.appendChild(newChild2); + appendedChild = employeeNode.appendChild(newdocFragment); + for(var indexN65698 = 0;indexN65698 < childList.length; indexN65698++) { + child = childList.item(indexN65698); + nodeType = child.nodeType; + + + if( + (1 == nodeType) + ) { + childName = child.nodeName; + + result[result.length] = childName; + + } + + } + assertEqualsListAutoCase("element", "nodeNames",expected,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchilddocfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html new file mode 100644 index 0000000000..a442688122 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildgetnodename.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildgetnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchildgetnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchildgetnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method returns the node + added. + + Append a newly created node to the child list of the + second employee and check the NodeName returned. The + "getNodeName()" method should return "br". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeappendchildgetnodename() { + var success; + if(checkInitialization(builder, "hc_nodeappendchildgetnodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var newChild; + var appendNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + newChild = doc.createElement("br"); + appendNode = employeeNode.appendChild(newChild); + childName = appendNode.nodeName; + + assertEqualsAutoCase("element", "nodeName","br",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildgetnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html new file mode 100644 index 0000000000..3856357966 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildinvalidnodetype.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildinvalidnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchildinvalidnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchildinvalidnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if this node is of + a type that does not allow children of the type "newChild" + to be inserted. + + Retrieve the root node and attempt to append a newly + created Attr node. An Element node cannot have children + of the "Attr" type, therefore the desired exception + should be raised. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_nodeappendchildinvalidnodetype() { + var success; + if(checkInitialization(builder, "hc_nodeappendchildinvalidnodetype") != null) return; + var doc; + var rootNode; + var newChild; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + rootNode = doc.documentElement; + + newChild = doc.createAttribute("newAttribute"); + + { + success = false; + try { + appendedChild = rootNode.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildinvalidnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html new file mode 100644 index 0000000000..8a4ff79c85 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnewchilddiffdocument.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnewchilddiffdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchildnewchilddiffdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchildnewchilddiffdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method raises a + WRONG_DOCUMENT_ERR DOMException if the "newChild" was + created from a different document than the one that + created this node. + + Retrieve the second employee and attempt to append + a node created from a different document. An attempt + to make such a replacement should raise the desired + exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeappendchildnewchilddiffdocument() { + var success; + if(checkInitialization(builder, "hc_nodeappendchildnewchilddiffdocument") != null) return; + var doc1; + var doc2; + var newChild; + var elementList; + var elementNode; + var appendedChild; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "hc_staff"); + newChild = doc1.createElement("br"); + elementList = doc2.getElementsByTagName("p"); + elementNode = elementList.item(1); + + { + success = false; + try { + appendedChild = elementNode.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnewchilddiffdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc1" src="files/hc_staff.html"></iframe> +<br> +<iframe name="doc2" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html new file mode 100644 index 0000000000..ddd7e729a5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeappendchildnodeancestor.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnodeancestor</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeappendchildnodeancestor']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeappendchildnodeancestor'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if the node to + append is one of this node's ancestors. + + Retrieve the second employee and attempt to append + an ancestor node(root node) to it. + An attempt to make such an addition should raise the + desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function hc_nodeappendchildnodeancestor() { + var success; + if(checkInitialization(builder, "hc_nodeappendchildnodeancestor") != null) return; + var doc; + var newChild; + var elementList; + var employeeNode; + var childList; + var oldChild; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.documentElement; + + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + + { + success = false; + try { + appendedChild = employeeNode.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildnodeancestor</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html new file mode 100644 index 0000000000..03866739be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodeattribute.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeattributenodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeattributenodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on an Attribute +Node returns null. + +Retrieve the first attribute from the last child of the +first employee and invoke the "getAttributes()" method +on the Attribute Node. It should return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function hc_nodeattributenodeattribute() { + var success; + if(checkInitialization(builder, "hc_nodeattributenodeattribute") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + addrAttr = testAddr.attributes; + + attrNode = addrAttr.item(0); + attrList = attrNode.attributes; + + assertNull("nodeAttributeNodeAttributeAssert1",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html new file mode 100644 index 0000000000..0eaf79f13a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodename.html @@ -0,0 +1,131 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeattributenodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeattributenodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the Attribute named "title" from the last + child of the first p element and check the string returned + by the "getNodeName()" method. It should be equal to + "title". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +*/ +function hc_nodeattributenodename() { + var success; + if(checkInitialization(builder, "hc_nodeattributenodename") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNode("title"); + attrName = addrAttr.nodeName; + + assertEqualsAutoCase("attribute", "nodeName","title",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html new file mode 100644 index 0000000000..edb0584e93 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodetype.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeattributenodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeattributenodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getNodeType()" method for an Attribute Node + + returns the constant value 2. + + + + Retrieve the first attribute from the last child of + + the first employee and invoke the "getNodeType()" + + method. The method should return 2. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function hc_nodeattributenodetype() { + var success; + if(checkInitialization(builder, "hc_nodeattributenodetype") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNode("title"); + nodeType = addrAttr.nodeType; + + assertEquals("nodeAttrNodeTypeAssert1",2,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html new file mode 100644 index 0000000000..1486d18888 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeattributenodevalue.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeattributenodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeattributenodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The string returned by the "getNodeValue()" method for an + Attribute Node is the value of the Attribute. + + Retrieve the Attribute named "title" from the last + child of the first "p" and check the string returned + by the "getNodeValue()" method. It should be equal to + "Yes". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function hc_nodeattributenodevalue() { + var success; + if(checkInitialization(builder, "hc_nodeattributenodevalue") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNode("title"); + attrValue = addrAttr.nodeValue; + + assertEquals("nodeValue","Yes",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeattributenodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html new file mode 100644 index 0000000000..c150796d28 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodes.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodechildnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodechildnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getChildNodes()" method returns a NodeList + that contains all children of this node. + + Retrieve the second employee and check the NodeList + returned by the "getChildNodes()" method. The + length of the list should be 13. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodechildnodes() { + var success; + if(checkInitialization(builder, "hc_nodechildnodes") != null) return; + var doc; + var elementList; + var employeeNode; + var childNode; + var childNodes; + var nodeType; + var childName; + var actual = new Array(); + + expected = new Array(); + expected[0] = "em"; + expected[1] = "strong"; + expected[2] = "code"; + expected[3] = "sup"; + expected[4] = "var"; + expected[5] = "acronym"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childNodes = employeeNode.childNodes; + + for(var indexN65644 = 0;indexN65644 < childNodes.length; indexN65644++) { + childNode = childNodes.item(indexN65644); + nodeType = childNode.nodeType; + + childName = childNode.nodeName; + + + if( + (1 == nodeType) + ) { + actual[actual.length] = childName; + + } + + else { + assertEquals("textNodeType",3,nodeType); + + } + + } + assertEqualsListAutoCase("element", "elementNames",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html new file mode 100644 index 0000000000..06ce51dd23 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesappendchild.html @@ -0,0 +1,175 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesappendchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodechildnodesappendchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodechildnodesappendchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The NodeList returned by the "getChildNodes()" method + is live. Changes on the node's children are immediately + reflected on the nodes returned in the NodeList. + + Create a NodeList of the children of the second employee + and then add a newly created element that was created + by the "createElement()" method(Document Interface) to + the second employee by using the "appendChild()" method. + The length of the NodeList should reflect this new + addition to the child list. It should return the value 14. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodechildnodesappendchild() { + var success; + if(checkInitialization(builder, "hc_nodechildnodesappendchild") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var createdNode; + var childNode; + var childName; + var childType; + var textNode; + var actual = new Array(); + + expected = new Array(); + expected[0] = "em"; + expected[1] = "strong"; + expected[2] = "code"; + expected[3] = "sup"; + expected[4] = "var"; + expected[5] = "acronym"; + expected[6] = "br"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + createdNode = doc.createElement("br"); + employeeNode = employeeNode.appendChild(createdNode); + for(var indexN65671 = 0;indexN65671 < childList.length; indexN65671++) { + childNode = childList.item(indexN65671); + childName = childNode.nodeName; + + childType = childNode.nodeType; + + + if( + (1 == childType) + ) { + actual[actual.length] = childName; + + } + + else { + assertEquals("textNodeType",3,childType); + + } + + } + assertEqualsListAutoCase("element", "childElements",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesappendchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html new file mode 100644 index 0000000000..8efe3d92fd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodechildnodesempty.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesempty</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodechildnodesempty']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodechildnodesempty'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getChildNodes()" method returns a NodeList + that contains all children of this node. If there + are not any children, this is a NodeList that does not + contain any nodes. + + Retrieve the character data of the second "em" node and + invoke the "getChildNodes()" method. The + NodeList returned should not have any nodes. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodechildnodesempty() { + var success; + if(checkInitialization(builder, "hc_nodechildnodesempty") != null) return; + var doc; + var elementList; + var childList; + var employeeNode; + var textNode; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("em"); + employeeNode = elementList.item(1); + textNode = employeeNode.firstChild; + + childList = textNode.childNodes; + + length = childList.length; + + assertEquals("length_zero",0,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodechildnodesempty</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html new file mode 100644 index 0000000000..0e50b333ea --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecloneattributescopied.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecloneattributescopied</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodecloneattributescopied']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodecloneattributescopied'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second acronym element and invoke + the cloneNode method. The + duplicate node returned by the method should copy the + attributes associated with this node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 +*/ +function hc_nodecloneattributescopied() { + var success; + if(checkInitialization(builder, "hc_nodecloneattributescopied") != null) return; + var doc; + var elementList; + var addressNode; + var clonedNode; + var attributes; + var attributeNode; + var attributeName; + var result = new Array(); + + htmlExpected = new Array(); + htmlExpected[0] = "class"; + htmlExpected[1] = "title"; + + expected = new Array(); + expected[0] = "class"; + expected[1] = "title"; + expected[2] = "dir"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + addressNode = elementList.item(1); + clonedNode = addressNode.cloneNode(false); + attributes = clonedNode.attributes; + + for(var indexN65654 = 0;indexN65654 < attributes.length; indexN65654++) { + attributeNode = attributes.item(indexN65654); + attributeName = attributeNode.nodeName; + + result[result.length] = attributeName; + + } + + if( + + (builder.contentType == "text/html") + + ) { + assertEqualsCollection("nodeNames_html",toLowerArray(htmlExpected),toLowerArray(result)); + + } + + else { + assertEqualsCollection("nodeNames",expected,result); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecloneattributescopied</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html new file mode 100644 index 0000000000..190cb2e000 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonefalsenocopytext.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonefalsenocopytext</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeclonefalsenocopytext']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeclonefalsenocopytext'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method does not copy text unless it + is deep cloned.(Test for deep=false) + + Retrieve the fourth child of the second employee and + the "cloneNode(deep)" method with deep=false. The + duplicate node returned by the method should not copy + any text data contained in this node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function hc_nodeclonefalsenocopytext() { + var success; + if(checkInitialization(builder, "hc_nodeclonefalsenocopytext") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var childNode; + var clonedNode; + var lastChildNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + childNode = childList.item(3); + clonedNode = childNode.cloneNode(false); + lastChildNode = clonedNode.lastChild; + + assertNull("nodeCloneFalseNoCopyTextAssert1",lastChildNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonefalsenocopytext</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html new file mode 100644 index 0000000000..5b7b3218f2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonegetparentnull.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonegetparentnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeclonegetparentnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeclonegetparentnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The duplicate node returned by the "cloneNode(deep)" + method does not have a ParentNode. + + Retrieve the second employee and invoke the + "cloneNode(deep)" method with deep=false. The + duplicate node returned should return null when the + "getParentNode()" is invoked. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function hc_nodeclonegetparentnull() { + var success; + if(checkInitialization(builder, "hc_nodeclonegetparentnull") != null) return; + var doc; + var elementList; + var employeeNode; + var clonedNode; + var parentNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + clonedNode = employeeNode.cloneNode(false); + parentNode = clonedNode.parentNode; + + assertNull("nodeCloneGetParentNullAssert1",parentNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonegetparentnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html new file mode 100644 index 0000000000..c0c2980f16 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodefalse.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodefalse</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeclonenodefalse']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeclonenodefalse'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method returns a copy of the node + only if deep=false. + + Retrieve the second employee and invoke the + "cloneNode(deep)" method with deep=false. The + method should only clone this node. The NodeName and + length of the NodeList are checked. The "getNodeName()" + method should return "employee" and the "getLength()" + method should return 0. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function hc_nodeclonenodefalse() { + var success; + if(checkInitialization(builder, "hc_nodeclonenodefalse") != null) return; + var doc; + var elementList; + var employeeNode; + var clonedNode; + var cloneName; + var cloneChildren; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + clonedNode = employeeNode.cloneNode(false); + cloneName = clonedNode.nodeName; + + assertEqualsAutoCase("element", "strong","p",cloneName); + cloneChildren = clonedNode.childNodes; + + length = cloneChildren.length; + + assertEquals("length",0,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodefalse</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html new file mode 100644 index 0000000000..ef109eb49e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonenodetrue.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodetrue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeclonenodetrue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeclonenodetrue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method returns a copy of the node + and the subtree under it if deep=true. + + Retrieve the second employee and invoke the + "cloneNode(deep)" method with deep=true. The + method should clone this node and the subtree under it. + The NodeName of each child in the returned node is + checked to insure the entire subtree under the second + employee was cloned. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodeclonenodetrue() { + var success; + if(checkInitialization(builder, "hc_nodeclonenodetrue") != null) return; + var doc; + var elementList; + var employeeNode; + var clonedNode; + var clonedList; + var clonedChild; + var clonedChildName; + var origList; + var origChild; + var origChildName; + var result = new Array(); + + var expected = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + origList = employeeNode.childNodes; + + for(var indexN65637 = 0;indexN65637 < origList.length; indexN65637++) { + origChild = origList.item(indexN65637); + origChildName = origChild.nodeName; + + expected[expected.length] = origChildName; + + } + clonedNode = employeeNode.cloneNode(true); + clonedList = clonedNode.childNodes; + + for(var indexN65659 = 0;indexN65659 < clonedList.length; indexN65659++) { + clonedChild = clonedList.item(indexN65659); + clonedChildName = clonedChild.nodeName; + + result[result.length] = clonedChildName; + + } + assertEqualsList("clone",expected,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonenodetrue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html new file mode 100644 index 0000000000..219c832b88 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeclonetruecopytext.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonetruecopytext</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeclonetruecopytext']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeclonetruecopytext'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method does not copy text unless it + is deep cloned.(Test for deep=true) + + Retrieve the eighth child of the second employee and + the "cloneNode(deep)" method with deep=true. The + duplicate node returned by the method should copy + any text data contained in this node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodeclonetruecopytext() { + var success; + if(checkInitialization(builder, "hc_nodeclonetruecopytext") != null) return; + var doc; + var elementList; + var childNode; + var clonedNode; + var lastChildNode; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("sup"); + childNode = elementList.item(1); + clonedNode = childNode.cloneNode(true); + lastChildNode = clonedNode.lastChild; + + childValue = lastChildNode.nodeValue; + + assertEquals("cloneContainsText","35,000",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeclonetruecopytext</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html new file mode 100644 index 0000000000..df2bb63cab --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodeattributes.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodecommentnodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodecommentnodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method invoked on a Comment + Node returns null. + + Find any comment that is an immediate child of the root + and assert that Node.attributes is null. Then create + a new comment node (in case they had been omitted) and + make the assertion. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=263 +*/ +function hc_nodecommentnodeattributes() { + var success; + if(checkInitialization(builder, "hc_nodecommentnodeattributes") != null) return; + var doc; + var commentNode; + var nodeList; + var attrList; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + nodeList = doc.childNodes; + + for(var indexN65603 = 0;indexN65603 < nodeList.length; indexN65603++) { + commentNode = nodeList.item(indexN65603); + nodeType = commentNode.nodeType; + + + if( + (8 == nodeType) + ) { + attrList = commentNode.attributes; + + assertNull("existingCommentAttributesNull",attrList); + + } + + } + commentNode = doc.createComment("This is a comment"); + attrList = commentNode.attributes; + + assertNull("createdCommentAttributesNull",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html new file mode 100644 index 0000000000..c998799835 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodename.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodecommentnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodecommentnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + Comment Node is "#comment". + + Retrieve the Comment node in the XML file + and check the string returned by the "getNodeName()" + method. It should be equal to "#comment". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 +*/ +function hc_nodecommentnodename() { + var success; + if(checkInitialization(builder, "hc_nodecommentnodename") != null) return; + var doc; + var elementList; + var commentNode; + var nodeType; + var commentName; + var commentNodeName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.childNodes; + + for(var indexN65604 = 0;indexN65604 < elementList.length; indexN65604++) { + commentNode = elementList.item(indexN65604); + nodeType = commentNode.nodeType; + + + if( + (8 == nodeType) + ) { + commentNodeName = commentNode.nodeName; + + assertEquals("existingNodeName","#comment",commentNodeName); + + } + + } + commentNode = doc.createComment("This is a comment"); + commentNodeName = commentNode.nodeName; + + assertEquals("createdNodeName","#comment",commentNodeName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html new file mode 100644 index 0000000000..e8bbc72a05 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodetype.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodecommentnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodecommentnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for a Comment Node + returns the constant value 8. + + Retrieve the nodes from the document and check for + a comment node and invoke the "getNodeType()" method. This should + return 8. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 +*/ +function hc_nodecommentnodetype() { + var success; + if(checkInitialization(builder, "hc_nodecommentnodetype") != null) return; + var doc; + var testList; + var commentNode; + var commentNodeName; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + testList = doc.childNodes; + + for(var indexN65600 = 0;indexN65600 < testList.length; indexN65600++) { + commentNode = testList.item(indexN65600); + commentNodeName = commentNode.nodeName; + + + if( + ("#comment" == commentNodeName) + ) { + nodeType = commentNode.nodeType; + + assertEquals("existingCommentNodeType",8,nodeType); + + } + + } + commentNode = doc.createComment("This is a comment"); + nodeType = commentNode.nodeType; + + assertEquals("createdCommentNodeType",8,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html new file mode 100644 index 0000000000..6b94e119af --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodecommentnodevalue.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodecommentnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodecommentnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Comment Node is the content of the comment. + + Retrieve the comment in the XML file and + check the string returned by the "getNodeValue()" method. + It should be equal to "This is comment number 1". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 +*/ +function hc_nodecommentnodevalue() { + var success; + if(checkInitialization(builder, "hc_nodecommentnodevalue") != null) return; + var doc; + var elementList; + var commentNode; + var commentName; + var commentValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.childNodes; + + for(var indexN65600 = 0;indexN65600 < elementList.length; indexN65600++) { + commentNode = elementList.item(indexN65600); + commentName = commentNode.nodeName; + + + if( + ("#comment" == commentName) + ) { + commentValue = commentNode.nodeValue; + + assertEquals("value"," This is comment number 1.",commentValue); + + } + + } + commentNode = doc.createComment(" This is a comment"); + commentValue = commentNode.nodeValue; + + assertEquals("createdCommentNodeValue"," This is a comment",commentValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodecommentnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html new file mode 100644 index 0000000000..30a0bed036 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodename.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentfragmentnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentfragmentnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + DocumentFragment Node is "#document-frament". + + Retrieve the DOM document and invoke the + "createDocumentFragment()" method and check the string + returned by the "getNodeName()" method. It should be + equal to "#document-fragment". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function hc_nodedocumentfragmentnodename() { + var success; + if(checkInitialization(builder, "hc_nodedocumentfragmentnodename") != null) return; + var doc; + var docFragment; + var documentFragmentName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docFragment = doc.createDocumentFragment(); + documentFragmentName = docFragment.nodeName; + + assertEquals("nodeDocumentFragmentNodeNameAssert1","#document-fragment",documentFragmentName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html new file mode 100644 index 0000000000..bc1ca4c38f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodetype.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentfragmentnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentfragmentnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for a DocumentFragment Node + returns the constant value 11. + + Invoke the "createDocumentFragment()" method and + examine the NodeType of the document fragment + returned by the "getNodeType()" method. The method + should return 11. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function hc_nodedocumentfragmentnodetype() { + var success; + if(checkInitialization(builder, "hc_nodedocumentfragmentnodetype") != null) return; + var doc; + var documentFragmentNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + documentFragmentNode = doc.createDocumentFragment(); + nodeType = documentFragmentNode.nodeType; + + assertEquals("nodeDocumentFragmentNodeTypeAssert1",11,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html new file mode 100644 index 0000000000..9855a3dc9d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentfragmentnodevalue.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentfragmentnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentfragmentnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + DocumentFragment Node is null. + + Retrieve the DOM document and invoke the + "createDocumentFragment()" method and check the string + returned by the "getNodeValue()" method. It should be + equal to null. + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function hc_nodedocumentfragmentnodevalue() { + var success; + if(checkInitialization(builder, "hc_nodedocumentfragmentnodevalue") != null) return; + var doc; + var docFragment; + var attrList; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docFragment = doc.createDocumentFragment(); + attrList = docFragment.attributes; + + assertNull("attributesNull",attrList); + value = docFragment.nodeValue; + + assertNull("initiallyNull",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentfragmentnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html new file mode 100644 index 0000000000..da4e369e52 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodeattribute.html @@ -0,0 +1,127 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentnodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentnodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on a Document +Node returns null. + +Retrieve the DOM Document and invoke the +"getAttributes()" method on the Document Node. +It should return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +*/ +function hc_nodedocumentnodeattribute() { + var success; + if(checkInitialization(builder, "hc_nodedocumentnodeattribute") != null) return; + var doc; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + attrList = doc.attributes; + + assertNull("doc_attributes_is_null",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html new file mode 100644 index 0000000000..23997204bf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodename.html @@ -0,0 +1,127 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + Document Node is "#document". + + Retrieve the DOM document and check the string returned + by the "getNodeName()" method. It should be equal to + "#document". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function hc_nodedocumentnodename() { + var success; + if(checkInitialization(builder, "hc_nodedocumentnodename") != null) return; + var doc; + var documentName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + documentName = doc.nodeName; + + assertEquals("documentNodeName","#document",documentName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html new file mode 100644 index 0000000000..e1f31e53ee --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodetype.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getNodeType()" method for a Document Node +returns the constant value 9. + +Retrieve the document and invoke the "getNodeType()" +method. The method should return 9. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function hc_nodedocumentnodetype() { + var success; + if(checkInitialization(builder, "hc_nodedocumentnodetype") != null) return; + var doc; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + nodeType = doc.nodeType; + + assertEquals("nodeDocumentNodeTypeAssert1",9,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html new file mode 100644 index 0000000000..c4b2f16af3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodedocumentnodevalue.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodedocumentnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodedocumentnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Document Node is null. + + Retrieve the DOM Document and check the string returned + by the "getNodeValue()" method. It should be equal to + null. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function hc_nodedocumentnodevalue() { + var success; + if(checkInitialization(builder, "hc_nodedocumentnodevalue") != null) return; + var doc; + var documentValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + documentValue = doc.nodeValue; + + assertNull("documentNodeValue",documentValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodedocumentnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html new file mode 100644 index 0000000000..88b7a93b03 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodeattributes.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeelementnodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeelementnodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the third "acronym" element and evaluate Node.attributes. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 +*/ +function hc_nodeelementnodeattributes() { + var success; + if(checkInitialization(builder, "hc_nodeelementnodeattributes") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrNode; + var attrName; + var attrList = new Array(); + + htmlExpected = new Array(); + htmlExpected[0] = "title"; + htmlExpected[1] = "class"; + + expected = new Array(); + expected[0] = "title"; + expected[1] = "class"; + expected[2] = "dir"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(2); + addrAttr = testAddr.attributes; + + for(var indexN65648 = 0;indexN65648 < addrAttr.length; indexN65648++) { + attrNode = addrAttr.item(indexN65648); + attrName = attrNode.nodeName; + + attrList[attrList.length] = attrName; + + } + + if( + + (builder.contentType == "text/html") + + ) { + assertEqualsCollection("attrNames_html",toLowerArray(htmlExpected),toLowerArray(attrList)); + + } + + else { + assertEqualsCollection("attrNames",expected,attrList); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html new file mode 100644 index 0000000000..4f59341390 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodename.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeelementnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeelementnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the first Element Node(Root Node) of the + DOM object and check the string returned by the + "getNodeName()" method. It should be equal to its + tagName. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function hc_nodeelementnodename() { + var success; + if(checkInitialization(builder, "hc_nodeelementnodename") != null) return; + var doc; + var elementNode; + var elementName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementNode = doc.documentElement; + + elementName = elementNode.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgNodeName","svg",elementName); + + } + + else { + assertEqualsAutoCase("element", "nodeName","html",elementName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html new file mode 100644 index 0000000000..27246a3c19 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodetype.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeelementnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeelementnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for an Element Node + returns the constant value 1. + + Retrieve the root node and invoke the "getNodeType()" + method. The method should return 1. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function hc_nodeelementnodetype() { + var success; + if(checkInitialization(builder, "hc_nodeelementnodetype") != null) return; + var doc; + var rootNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + rootNode = doc.documentElement; + + nodeType = rootNode.nodeType; + + assertEquals("nodeElementNodeTypeAssert1",1,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html new file mode 100644 index 0000000000..1be40633a3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeelementnodevalue.html @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeelementnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeelementnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for an + Element Node is null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function hc_nodeelementnodevalue() { + var success; + if(checkInitialization(builder, "hc_nodeelementnodevalue") != null) return; + var doc; + var elementNode; + var elementValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementNode = doc.documentElement; + + elementValue = elementNode.nodeValue; + + assertNull("elementNodeValue",elementValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html new file mode 100644 index 0000000000..7ff30dca3d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchild.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetfirstchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetfirstchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getFirstChild()" method returns the first child + of this node. + + Retrieve the second employee and invoke the + "getFirstChild()" method. The NodeName returned + should be "#text" or "EM". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodegetfirstchild() { + var success; + if(checkInitialization(builder, "hc_nodegetfirstchild") != null) return; + var doc; + var elementList; + var employeeNode; + var fchildNode; + var childName; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + fchildNode = employeeNode.firstChild; + + childName = fchildNode.nodeName; + + + if( + ("#text" == childName) + ) { + assertEquals("firstChild_w_whitespace","#text",childName); + + } + + else { + assertEqualsAutoCase("element", "firstChild_wo_whitespace","em",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html new file mode 100644 index 0000000000..cb34690c64 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetfirstchildnull.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchildnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetfirstchildnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetfirstchildnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If there is not a first child then the "getFirstChild()" + method returns null. + + Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It + should return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodegetfirstchildnull() { + var success; + if(checkInitialization(builder, "hc_nodegetfirstchildnull") != null) return; + var doc; + var emList; + var emNode; + var emText; + var nullChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + emList = doc.getElementsByTagName("em"); + emNode = emList.item(0); + emText = emNode.firstChild; + + nullChild = emText.firstChild; + + assertNull("nullChild",nullChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetfirstchildnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html new file mode 100644 index 0000000000..fdf42c3b48 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchild.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetlastchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetlastchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLastChild()" method returns the last child + of this node. + + Retrieve the second employee and invoke the + "getLastChild()" method. The NodeName returned + should be "#text". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB +*/ +function hc_nodegetlastchild() { + var success; + if(checkInitialization(builder, "hc_nodegetlastchild") != null) return; + var doc; + var elementList; + var employeeNode; + var lchildNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + lchildNode = employeeNode.lastChild; + + childName = lchildNode.nodeName; + + assertEquals("whitespace","#text",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html new file mode 100644 index 0000000000..5b07c81dd2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetlastchildnull.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchildnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetlastchildnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetlastchildnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a last child then the "getLastChild()" + method returns null. + + Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It + should return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodegetlastchildnull() { + var success; + if(checkInitialization(builder, "hc_nodegetlastchildnull") != null) return; + var doc; + var emList; + var emNode; + var emText; + var nullChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + emList = doc.getElementsByTagName("em"); + emNode = emList.item(0); + emText = emNode.firstChild; + + nullChild = emText.lastChild; + + assertNull("nullChild",nullChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetlastchildnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html new file mode 100644 index 0000000000..d783a89d4a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsibling.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsibling</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetnextsibling']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetnextsibling'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNextSibling()" method returns the node immediately + following this node. + + Retrieve the first child of the second employee and + invoke the "getNextSibling()" method. It should return + a node with the NodeName of "#text". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F +*/ +function hc_nodegetnextsibling() { + var success; + if(checkInitialization(builder, "hc_nodegetnextsibling") != null) return; + var doc; + var elementList; + var emNode; + var nsNode; + var nsName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("em"); + emNode = elementList.item(1); + nsNode = emNode.nextSibling; + + nsName = nsNode.nodeName; + + assertEquals("whitespace","#text",nsName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsibling</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html new file mode 100644 index 0000000000..ac1b56eb05 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetnextsiblingnull.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetnextsiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetnextsiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a node immediately following this node the + + "getNextSibling()" method returns null. + + + + Retrieve the first child of the second employee and + + invoke the "getNextSibling()" method. It should + + be set to null. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F +*/ +function hc_nodegetnextsiblingnull() { + var success; + if(checkInitialization(builder, "hc_nodegetnextsiblingnull") != null) return; + var doc; + var elementList; + var employeeNode; + var lcNode; + var nsNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + lcNode = employeeNode.lastChild; + + nsNode = lcNode.nextSibling; + + assertNull("nodeGetNextSiblingNullAssert1",nsNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetnextsiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html new file mode 100644 index 0000000000..6915820a37 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocument.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetownerdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetownerdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Evaluate Node.ownerDocument on the second "p" element. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function hc_nodegetownerdocument() { + var success; + if(checkInitialization(builder, "hc_nodegetownerdocument") != null) return; + var doc; + var elementList; + var docNode; + var ownerDocument; + var docElement; + var elementName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + docNode = elementList.item(1); + ownerDocument = docNode.ownerDocument; + + docElement = ownerDocument.documentElement; + + elementName = docElement.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgNodeName","svg",elementName); + + } + + else { + assertEqualsAutoCase("element", "ownerDocElemTagName","html",elementName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html new file mode 100644 index 0000000000..560963c927 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetownerdocumentnull.html @@ -0,0 +1,131 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocumentnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetownerdocumentnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetownerdocumentnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getOwnerDocument()" method returns null if the target + + node itself is a document. + + + + Invoke the "getOwnerDocument()" method on the master + + document. The Document returned should be null. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc +*/ +function hc_nodegetownerdocumentnull() { + var success; + if(checkInitialization(builder, "hc_nodegetownerdocumentnull") != null) return; + var doc; + var ownerDocument; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + ownerDocument = doc.ownerDocument; + + assertNull("nodeGetOwnerDocumentNullAssert1",ownerDocument); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetownerdocumentnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html new file mode 100644 index 0000000000..e7a9e06c89 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussibling.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussibling</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetprevioussibling']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetprevioussibling'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getPreviousSibling()" method returns the node + immediately preceding this node. + + Retrieve the second child of the second employee and + invoke the "getPreviousSibling()" method. It should + return a node with a NodeName of "#text". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 +*/ +function hc_nodegetprevioussibling() { + var success; + if(checkInitialization(builder, "hc_nodegetprevioussibling") != null) return; + var doc; + var elementList; + var nameNode; + var psNode; + var psName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(1); + psNode = nameNode.previousSibling; + + psName = psNode.nodeName; + + assertEquals("whitespace","#text",psName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussibling</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html new file mode 100644 index 0000000000..6927eadbcf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodegetprevioussiblingnull.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodegetprevioussiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodegetprevioussiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a node immediately preceding this node the + + "getPreviousSibling()" method returns null. + + + + Retrieve the first child of the second employee and + + invoke the "getPreviousSibling()" method. It should + + be set to null. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 +*/ +function hc_nodegetprevioussiblingnull() { + var success; + if(checkInitialization(builder, "hc_nodegetprevioussiblingnull") != null) return; + var doc; + var elementList; + var employeeNode; + var fcNode; + var psNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + fcNode = employeeNode.firstChild; + + psNode = fcNode.previousSibling; + + assertNull("nodeGetPreviousSiblingNullAssert1",psNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodegetprevioussiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html new file mode 100644 index 0000000000..5334c085be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodes.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodehaschildnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodehaschildnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "hasChildNodes()" method returns true if the node + has children. + + Retrieve the root node("staff") and invoke the + "hasChildNodes()" method. It should return the boolean + value "true". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 +*/ +function hc_nodehaschildnodes() { + var success; + if(checkInitialization(builder, "hc_nodehaschildnodes") != null) return; + var doc; + var elementList; + var employeeNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + state = employeeNode.hasChildNodes(); + assertTrue("nodeHasChildAssert1",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html new file mode 100644 index 0000000000..ac8fcdedbd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodehaschildnodesfalse.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodesfalse</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodehaschildnodesfalse']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodehaschildnodesfalse'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "hasChildNodes()" method returns false if the node + does not have any children. + + Retrieve the text of the first "em" element and invoke the "hasChildNodes()" method. It + should return false. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodehaschildnodesfalse() { + var success; + if(checkInitialization(builder, "hc_nodehaschildnodesfalse") != null) return; + var doc; + var emList; + var emNode; + var emText; + var hasChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + emList = doc.getElementsByTagName("em"); + emNode = emList.item(0); + emText = emNode.firstChild; + + hasChild = emText.hasChildNodes(); + assertFalse("hasChild",hasChild); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodehaschildnodesfalse</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html new file mode 100644 index 0000000000..37bce31f2b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbefore.html @@ -0,0 +1,169 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbefore</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbefore']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbefore'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method inserts the + node "newChild" before the node "refChild". + + Insert a newly created Element node before the second + sup element in the document and check the "newChild" + and "refChild" after insertion for correct placement. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=261 +*/ +function hc_nodeinsertbefore() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbefore") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newChild; + var child; + var childName; + var insertedNode; + var actual = new Array(); + + expected = new Array(); + expected[0] = "em"; + expected[1] = "strong"; + expected[2] = "code"; + expected[3] = "br"; + expected[4] = "sup"; + expected[5] = "var"; + expected[6] = "acronym"; + + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("sup"); + refChild = elementList.item(2); + employeeNode = refChild.parentNode; + + childList = employeeNode.childNodes; + + newChild = doc.createElement("br"); + insertedNode = employeeNode.insertBefore(newChild,refChild); + for(var indexN65681 = 0;indexN65681 < childList.length; indexN65681++) { + child = childList.item(indexN65681); + nodeType = child.nodeType; + + + if( + (1 == nodeType) + ) { + childName = child.nodeName; + + actual[actual.length] = childName; + + } + + } + assertEqualsListAutoCase("element", "nodeNames",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbefore</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html new file mode 100644 index 0000000000..b5fae9e6ed --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforedocfragment.html @@ -0,0 +1,157 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforedocfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforedocfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforedocfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is a DocumentFragment object then all + its children are inserted in the same order before the + the "refChild". + + Create a DocumentFragment object and populate it with + two Element nodes. Retrieve the second employee and + insert the newly created DocumentFragment before its + fourth child. The second employee should now have two + extra children("newChild1" and "newChild2") at + positions fourth and fifth respectively. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeinsertbeforedocfragment() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforedocfragment") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newdocFragment; + var newChild1; + var newChild2; + var child; + var childName; + var appendedChild; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + refChild = childList.item(3); + newdocFragment = doc.createDocumentFragment(); + newChild1 = doc.createElement("br"); + newChild2 = doc.createElement("b"); + appendedChild = newdocFragment.appendChild(newChild1); + appendedChild = newdocFragment.appendChild(newChild2); + insertedNode = employeeNode.insertBefore(newdocFragment,refChild); + child = childList.item(3); + childName = child.nodeName; + + assertEqualsAutoCase("element", "childName3","br",childName); + child = childList.item(4); + childName = child.nodeName; + + assertEqualsAutoCase("element", "childName4","b",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforedocfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html new file mode 100644 index 0000000000..e5519b30d4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforeinvalidnodetype.html @@ -0,0 +1,152 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforeinvalidnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforeinvalidnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforeinvalidnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if this node is of + a type that does not allow children of the type "newChild" + to be inserted. + + Retrieve the root node and attempt to insert a newly + created Attr node. An Element node cannot have children + of the "Attr" type, therefore the desired exception + should be raised. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=406 +*/ +function hc_nodeinsertbeforeinvalidnodetype() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforeinvalidnodetype") != null) return; + var doc; + var rootNode; + var newChild; + var elementList; + var refChild; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.createAttribute("title"); + elementList = doc.getElementsByTagName("p"); + refChild = elementList.item(1); + rootNode = refChild.parentNode; + + + { + success = false; + try { + insertedNode = rootNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforeinvalidnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html new file mode 100644 index 0000000000..767ab0dc28 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchilddiffdocument.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchilddiffdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforenewchilddiffdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforenewchilddiffdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + WRONG_DOCUMENT_ERR DOMException if the "newChild" was + created from a different document than the one that + created this node. + + Retrieve the second employee and attempt to insert a new + child that was created from a different document than the + one that created the second employee. An attempt to + insert such a child should raise the desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeinsertbeforenewchilddiffdocument() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforenewchilddiffdocument") != null) return; + var doc1; + var doc2; + var refChild; + var newChild; + var elementList; + var elementNode; + var insertedNode; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "hc_staff"); + newChild = doc1.createElement("br"); + elementList = doc2.getElementsByTagName("p"); + elementNode = elementList.item(1); + refChild = elementNode.firstChild; + + + { + success = false; + try { + insertedNode = elementNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchilddiffdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc1" src="files/hc_staff.html"></iframe> +<br> +<iframe name="doc2" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html new file mode 100644 index 0000000000..c4baeb0ba9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenewchildexists.html @@ -0,0 +1,167 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchildexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforenewchildexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforenewchildexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is already in the tree, the + "insertBefore(newChild,refChild)" method must first + remove it before the insertion takes place. + + Insert a node Element ("em") that is already + present in the tree. The existing node should be + removed first and the new one inserted. The node is + inserted at a different position in the tree to assure + that it was indeed inserted. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodeinsertbeforenewchildexists() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforenewchildexists") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newChild; + var child; + var childName; + var insertedNode; + expected = new Array(); + expected[0] = "strong"; + expected[1] = "code"; + expected[2] = "sup"; + expected[3] = "var"; + expected[4] = "em"; + expected[5] = "acronym"; + + var result = new Array(); + + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.getElementsByTagName("*"); + refChild = childList.item(5); + newChild = childList.item(0); + insertedNode = employeeNode.insertBefore(newChild,refChild); + for(var indexN65676 = 0;indexN65676 < childList.length; indexN65676++) { + child = childList.item(indexN65676); + nodeType = child.nodeType; + + + if( + (1 == nodeType) + ) { + childName = child.nodeName; + + result[result.length] = childName; + + } + + } + assertEqualsListAutoCase("element", "childNames",expected,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchildexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html new file mode 100644 index 0000000000..0479ada809 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodeancestor.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodeancestor</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforenodeancestor']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforenodeancestor'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if the node to be + inserted is one of this nodes ancestors. + + Retrieve the second employee and attempt to insert a + node that is one of its ancestors(root node). An + attempt to insert such a node should raise the + desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function hc_nodeinsertbeforenodeancestor() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforenodeancestor") != null) return; + var doc; + var newChild; + var elementList; + var employeeNode; + var childList; + var refChild; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.documentElement; + + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + refChild = childList.item(0); + + { + success = false; + try { + insertedNode = employeeNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodeancestor</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html new file mode 100644 index 0000000000..3eda9ad815 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforenodename.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforenodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforenodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refchild)" method returns + the node being inserted. + + Insert an Element node before the fourth + child of the second employee and check the node + returned from the "insertBefore(newChild,refChild)" + method. The node returned should be "newChild". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeinsertbeforenodename() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforenodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newChild; + var insertedNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + refChild = childList.item(3); + newChild = doc.createElement("br"); + insertedNode = employeeNode.insertBefore(newChild,refChild); + childName = insertedNode.nodeName; + + assertEqualsAutoCase("element", "nodeName","br",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html new file mode 100644 index 0000000000..2d62ddecc1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnonexistent.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnonexistent</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforerefchildnonexistent']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforerefchildnonexistent'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + NOT_FOUND_ERR DOMException if the reference child is + not a child of this node. + + Retrieve the second employee and attempt to insert a + new node before a reference node that is not a child + of this node. An attempt to insert before a non child + node should raise the desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_nodeinsertbeforerefchildnonexistent() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforerefchildnonexistent") != null) return; + var doc; + var refChild; + var newChild; + var elementList; + var elementNode; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.createElement("br"); + refChild = doc.createElement("b"); + elementList = doc.getElementsByTagName("p"); + elementNode = elementList.item(1); + + { + success = false; + try { + insertedNode = elementNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnonexistent</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html new file mode 100644 index 0000000000..1e426771a4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeinsertbeforerefchildnull.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeinsertbeforerefchildnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeinsertbeforerefchildnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "refChild" is null then the + "insertBefore(newChild,refChild)" method inserts the + node "newChild" at the end of the list of children. + + Retrieve the second employee and invoke the + "insertBefore(newChild,refChild)" method with + refChild=null. Since "refChild" is null the "newChild" + should be added to the end of the list. The last item + in the list is checked after insertion. The last Element + node of the list should be "newChild". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeinsertbeforerefchildnull() { + var success; + if(checkInitialization(builder, "hc_nodeinsertbeforerefchildnull") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild = null; + + var newChild; + var child; + var childName; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + newChild = doc.createElement("br"); + insertedNode = employeeNode.insertBefore(newChild,refChild); + child = employeeNode.lastChild; + + childName = child.nodeName; + + assertEqualsAutoCase("element", "nodeName","br",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforerefchildnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html new file mode 100644 index 0000000000..6a62a3c148 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexequalzero.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexequalzero</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelistindexequalzero']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelistindexequalzero'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a list of all the children elements of the third + employee and access its first child by using an index + of 0. This should result in the whitspace before "em" being + selected (em when ignoring whitespace). + Further we evaluate its content(by using + the "getNodeName()" method) to ensure the proper + element was accessed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelistindexequalzero() { + var success; + if(checkInitialization(builder, "hc_nodelistindexequalzero") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + length = employeeList.length; + + child = employeeList.item(0); + childName = child.nodeName; + + + if( + (13 == length) + ) { + assertEquals("childName_w_whitespace","#text",childName); + + } + + else { + assertEqualsAutoCase("element", "childName_wo_whitespace","em",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexequalzero</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html new file mode 100644 index 0000000000..4e9e2637e5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlength.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelistindexgetlength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelistindexgetlength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of nodes + in the list. + + Create a list of all the children elements of the third + employee and invoke the "getLength()" method. + It should contain the value 13. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelistindexgetlength() { + var success; + if(checkInitialization(builder, "hc_nodelistindexgetlength") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + length = employeeList.length; + + + if( + (6 == length) + ) { + assertEquals("length_wo_space",6,length); + + } + + else { + assertEquals("length_w_space",13,length); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html new file mode 100644 index 0000000000..479d8aa475 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexgetlengthofemptylist.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlengthofemptylist</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelistindexgetlengthofemptylist']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelistindexgetlengthofemptylist'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of nodes + in the list.(Test for EMPTY list) + + Create a list of all the children of the Text node + inside the first child of the third employee and + invoke the "getLength()" method. It should contain + the value 0. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelistindexgetlengthofemptylist() { + var success; + if(checkInitialization(builder, "hc_nodelistindexgetlengthofemptylist") != null) return; + var doc; + var emList; + var emNode; + var textNode; + var textList; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + emList = doc.getElementsByTagName("em"); + emNode = emList.item(2); + textNode = emNode.firstChild; + + textList = textNode.childNodes; + + length = textList.length; + + assertEquals("length",0,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexgetlengthofemptylist</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html new file mode 100644 index 0000000000..785b264459 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistindexnotzero.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexnotzero</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelistindexnotzero']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelistindexnotzero'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The items in the list are accessible via an integral + index starting from zero. + (Index not equal 0) + + Create a list of all the children elements of the third + employee and access its fourth child by using an index + of 3 and calling getNodeName() which should return + "strong" (no whitespace) or "#text" (with whitespace). + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelistindexnotzero() { + var success; + if(checkInitialization(builder, "hc_nodelistindexnotzero") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + child = employeeList.item(3); + childName = child.nodeName; + + + if( + ("#text" == childName) + ) { + assertEquals("childName_space","#text",childName); + + } + + else { + assertEqualsAutoCase("element", "childName_strong","strong",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistindexnotzero</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html new file mode 100644 index 0000000000..d292915501 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnfirstitem.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnfirstitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelistreturnfirstitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelistreturnfirstitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a list of all the children elements of the third + employee and access its first child by invoking the + "item(index)" method with an index=0. This should + result in node with a nodeName of "#text" or "em". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelistreturnfirstitem() { + var success; + if(checkInitialization(builder, "hc_nodelistreturnfirstitem") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + child = employeeList.item(0); + childName = child.nodeName; + + + if( + ("#text" == childName) + ) { + assertEquals("nodeName_w_space","#text",childName); + + } + + else { + assertEqualsAutoCase("element", "nodeName_wo_space","em",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnfirstitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html new file mode 100644 index 0000000000..4a86eb2086 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelistreturnlastitem.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnlastitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelistreturnlastitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelistreturnlastitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a list of all the children elements of the third + employee and access its last child by invoking the + "item(index)" method with an index=length-1. This should + result in node with nodeName="#text" or acronym. +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelistreturnlastitem() { + var success; + if(checkInitialization(builder, "hc_nodelistreturnlastitem") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + var index; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + index = employeeList.length; + + index -= 1; +child = employeeList.item(index); + childName = child.nodeName; + + + if( + (12 == index) + ) { + assertEquals("lastNodeName_w_whitespace","#text",childName); + + } + + else { + assertEqualsAutoCase("element", "lastNodeName","acronym",childName); + assertEquals("index",5,index); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelistreturnlastitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html new file mode 100644 index 0000000000..206bde8130 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodelisttraverselist.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelisttraverselist</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodelisttraverselist']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodelisttraverselist'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The range of valid child node indices is 0 thru length -1 + + Create a list of all the children elements of the third + employee and traverse the list from index=0 thru + length -1. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodelisttraverselist() { + var success; + if(checkInitialization(builder, "hc_nodelisttraverselist") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + var nodeType; + var result = new Array(); + + expected = new Array(); + expected[0] = "em"; + expected[1] = "strong"; + expected[2] = "code"; + expected[3] = "sup"; + expected[4] = "var"; + expected[5] = "acronym"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + for(var indexN65651 = 0;indexN65651 < employeeList.length; indexN65651++) { + child = employeeList.item(indexN65651); + nodeType = child.nodeType; + + childName = child.nodeName; + + + if( + (1 == nodeType) + ) { + result[result.length] = childName; + + } + + else { + assertEquals("textNodeType",3,nodeType); + assertEquals("textNodeName","#text",childName); + + } + + } + assertEqualsListAutoCase("element", "nodeNames",expected,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodelisttraverselist</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html new file mode 100644 index 0000000000..62b16bafcd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnode.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeparentnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeparentnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getParentNode()" method returns the parent + of this node. + + Retrieve the second employee and invoke the + "getParentNode()" method on this node. It should + be set to "body". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 +*/ +function hc_nodeparentnode() { + var success; + if(checkInitialization(builder, "hc_nodeparentnode") != null) return; + var doc; + var elementList; + var employeeNode; + var parentNode; + var parentName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + parentNode = employeeNode.parentNode; + + parentName = parentNode.nodeName; + + assertEqualsAutoCase("element", "parentNodeName","body",parentName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html new file mode 100644 index 0000000000..1182b3eb12 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodeparentnodenull.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodeparentnodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodeparentnodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getParentNode()" method invoked on a node that has + just been created and not yet added to the tree is null. + + Create a new "employee" Element node using the + "createElement(name)" method from the Document interface. + Since this new node has not yet been added to the tree, + the "getParentNode()" method will return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodeparentnodenull() { + var success; + if(checkInitialization(builder, "hc_nodeparentnodenull") != null) return; + var doc; + var createdNode; + var parentNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + createdNode = doc.createElement("br"); + parentNode = createdNode.parentNode; + + assertNull("parentNode",parentNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeparentnodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html new file mode 100644 index 0000000000..ab60a3115b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechild.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_noderemovechild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_noderemovechild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method removes the child node + indicated by "oldChild" from the list of children and + returns it. + + Remove the first employee by invoking the + "removeChild(oldChild)" method an checking the + node returned by the "getParentNode()" method. It + should be set to null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_noderemovechild() { + var success; + if(checkInitialization(builder, "hc_noderemovechild") != null) return; + var doc; + var rootNode; + var childList; + var childToRemove; + var removedChild; + var parentNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + rootNode = doc.documentElement; + + childList = rootNode.childNodes; + + childToRemove = childList.item(1); + removedChild = rootNode.removeChild(childToRemove); + parentNode = removedChild.parentNode; + + assertNull("parentNodeNull",parentNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html new file mode 100644 index 0000000000..cc5776a9d5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildgetnodename.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildgetnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_noderemovechildgetnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_noderemovechildgetnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method returns + the node being removed. + + Remove the first child of the second employee + and check the NodeName returned by the + "removeChild(oldChild)" method. The returned node + should have a NodeName equal to "#text". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_noderemovechildgetnodename() { + var success; + if(checkInitialization(builder, "hc_noderemovechildgetnodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var removedChild; + var childName; + var oldName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + oldChild = childList.item(0); + oldName = oldChild.nodeName; + + removedChild = employeeNode.removeChild(oldChild); + assertNotNull("notnull",removedChild); +childName = removedChild.nodeName; + + assertEquals("nodeName",oldName,childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildgetnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html new file mode 100644 index 0000000000..cc2c7864ce --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildnode.html @@ -0,0 +1,176 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_noderemovechildnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_noderemovechildnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method removes the node + indicated by "oldChild". + + Retrieve the second p element and remove its first child. + After the removal, the second p element should have 5 element + children and the first child should now be the child + that used to be at the second position in the list. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_noderemovechildnode() { + var success; + if(checkInitialization(builder, "hc_noderemovechildnode") != null) return; + var doc; + var elementList; + var emList; + var employeeNode; + var childList; + var oldChild; + var child; + var childName; + var length; + var removedChild; + var removedName; + var nodeType; + expected = new Array(); + expected[0] = "strong"; + expected[1] = "code"; + expected[2] = "sup"; + expected[3] = "var"; + expected[4] = "acronym"; + + var actual = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + emList = employeeNode.getElementsByTagName("em"); + oldChild = emList.item(0); + removedChild = employeeNode.removeChild(oldChild); + removedName = removedChild.nodeName; + + assertEqualsAutoCase("element", "removedName","em",removedName); + for(var indexN65688 = 0;indexN65688 < childList.length; indexN65688++) { + child = childList.item(indexN65688); + nodeType = child.nodeType; + + childName = child.nodeName; + + + if( + (1 == nodeType) + ) { + actual[actual.length] = childName; + + } + + else { + assertEquals("textNodeType",3,nodeType); + assertEquals("textNodeName","#text",childName); + + } + + } + assertEqualsListAutoCase("element", "childNames",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html new file mode 100644 index 0000000000..18e1c0fa59 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_noderemovechildoldchildnonexistent.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildoldchildnonexistent</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_noderemovechildoldchildnonexistent']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_noderemovechildoldchildnonexistent'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method raises a + NOT_FOUND_ERR DOMException if the old child is + not a child of this node. + + Retrieve the second employee and attempt to remove a + node that is not one of its children. An attempt to + remove such a node should raise the desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_noderemovechildoldchildnonexistent() { + var success; + if(checkInitialization(builder, "hc_noderemovechildoldchildnonexistent") != null) return; + var doc; + var oldChild; + var elementList; + var elementNode; + var removedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + oldChild = doc.createElement("br"); + elementList = doc.getElementsByTagName("p"); + elementNode = elementList.item(1); + + { + success = false; + try { + removedChild = elementNode.removeChild(oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_noderemovechildoldchildnonexistent</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html new file mode 100644 index 0000000000..cfa08fcd69 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechild.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method replaces + the node "oldChild" with the node "newChild". + + Replace the first element of the second employee with + a newly created Element node. Check the first position + after the replacement operation is completed. The new + Element should be "newChild". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodereplacechild() { + var success; + if(checkInitialization(builder, "hc_nodereplacechild") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var newChild; + var child; + var childName; + var replacedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + oldChild = childList.item(0); + newChild = doc.createElement("br"); + replacedNode = employeeNode.replaceChild(newChild,oldChild); + child = childList.item(0); + childName = child.nodeName; + + assertEqualsAutoCase("element", "nodeName","br",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html new file mode 100644 index 0000000000..5db6d8f9ab --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildinvalidnodetype.html @@ -0,0 +1,152 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildinvalidnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechildinvalidnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechildinvalidnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if this node is of + a type that does not allow children of the type "newChild" + to be inserted. + + Retrieve the root node and attempt to replace + one of its children with a newly created Attr node. + An Element node cannot have children of the "Attr" + type, therefore the desired exception should be raised. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=406 +*/ +function hc_nodereplacechildinvalidnodetype() { + var success; + if(checkInitialization(builder, "hc_nodereplacechildinvalidnodetype") != null) return; + var doc; + var rootNode; + var newChild; + var elementList; + var oldChild; + var replacedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.createAttribute("lang"); + elementList = doc.getElementsByTagName("p"); + oldChild = elementList.item(1); + rootNode = oldChild.parentNode; + + + { + success = false; + try { + replacedChild = rootNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildinvalidnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html new file mode 100644 index 0000000000..9d0e93fbbc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchilddiffdocument.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchilddiffdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechildnewchilddiffdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "hc_staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechildnewchilddiffdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + WRONG_DOCUMENT_ERR DOMException if the "newChild" was + created from a different document than the one that + created this node. + + Retrieve the second employee and attempt to replace one + of its children with a node created from a different + document. An attempt to make such a replacement + should raise the desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodereplacechildnewchilddiffdocument() { + var success; + if(checkInitialization(builder, "hc_nodereplacechildnewchilddiffdocument") != null) return; + var doc1; + var doc2; + var oldChild; + var newChild; + var elementList; + var elementNode; + var replacedChild; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "hc_staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "hc_staff"); + newChild = doc1.createElement("br"); + elementList = doc2.getElementsByTagName("p"); + elementNode = elementList.item(1); + oldChild = elementNode.firstChild; + + + { + success = false; + try { + replacedChild = elementNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchilddiffdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc1" src="files/hc_staff.html"></iframe> +<br> +<iframe name="doc2" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html new file mode 100644 index 0000000000..826d79ce3e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnewchildexists.html @@ -0,0 +1,171 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchildexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechildnewchildexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechildnewchildexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is already in the tree, it is first + removed before the new one is added. + + Retrieve the second "p" and replace "acronym" with its "em". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 +*/ +function hc_nodereplacechildnewchildexists() { + var success; + if(checkInitialization(builder, "hc_nodereplacechildnewchildexists") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild = null; + + var newChild = null; + + var child; + var childName; + var childNode; + var actual = new Array(); + + expected = new Array(); + expected[0] = "strong"; + expected[1] = "code"; + expected[2] = "sup"; + expected[3] = "var"; + expected[4] = "em"; + + var replacedChild; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.getElementsByTagName("*"); + newChild = childList.item(0); + oldChild = childList.item(5); + replacedChild = employeeNode.replaceChild(newChild,oldChild); + assertSame("return_value_same",oldChild,replacedChild); +for(var indexN65684 = 0;indexN65684 < childList.length; indexN65684++) { + childNode = childList.item(indexN65684); + childName = childNode.nodeName; + + nodeType = childNode.nodeType; + + + if( + (1 == nodeType) + ) { + actual[actual.length] = childName; + + } + + else { + assertEquals("textNodeType",3,nodeType); + assertEquals("textNodeName","#text",childName); + + } + + } + assertEqualsListAutoCase("element", "childNames",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchildexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html new file mode 100644 index 0000000000..506b5912b7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodeancestor.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodeancestor</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechildnodeancestor']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechildnodeancestor'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if the node to put + in is one of this node's ancestors. + + Retrieve the second employee and attempt to replace + one of its children with an ancestor node(root node). + An attempt to make such a replacement should raise the + desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function hc_nodereplacechildnodeancestor() { + var success; + if(checkInitialization(builder, "hc_nodereplacechildnodeancestor") != null) return; + var doc; + var newChild; + var elementList; + var employeeNode; + var childList; + var oldChild; + var replacedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.documentElement; + + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + oldChild = childList.item(0); + + { + success = false; + try { + replacedNode = employeeNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodeancestor</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html new file mode 100644 index 0000000000..63c71df9b2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildnodename.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechildnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechildnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method returns + the node being replaced. + + Replace the second Element of the second employee with + a newly created node Element and check the NodeName + returned by the "replaceChild(newChild,oldChild)" + method. The returned node should have a NodeName equal + to "em". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodereplacechildnodename() { + var success; + if(checkInitialization(builder, "hc_nodereplacechildnodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var newChild; + var replacedNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("p"); + employeeNode = elementList.item(1); + childList = employeeNode.getElementsByTagName("em"); + oldChild = childList.item(0); + newChild = doc.createElement("br"); + replacedNode = employeeNode.replaceChild(newChild,oldChild); + childName = replacedNode.nodeName; + + assertEqualsAutoCase("element", "replacedNodeName","em",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html new file mode 100644 index 0000000000..e31b4b4949 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodereplacechildoldchildnonexistent.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildoldchildnonexistent</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodereplacechildoldchildnonexistent']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodereplacechildoldchildnonexistent'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + NOT_FOUND_ERR DOMException if the old child is + not a child of this node. + + Retrieve the second employee and attempt to replace a + node that is not one of its children. An attempt to + replace such a node should raise the desired exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 +*/ +function hc_nodereplacechildoldchildnonexistent() { + var success; + if(checkInitialization(builder, "hc_nodereplacechildoldchildnonexistent") != null) return; + var doc; + var oldChild; + var newChild; + var elementList; + var elementNode; + var replacedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newChild = doc.createElement("br"); + oldChild = doc.createElement("b"); + elementList = doc.getElementsByTagName("p"); + elementNode = elementList.item(1); + + { + success = false; + try { + replacedNode = elementNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildoldchildnonexistent</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html new file mode 100644 index 0000000000..b34c477d84 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodeattribute.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodetextnodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodetextnodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on a Text +Node returns null. + +Retrieve the Text node from the last child of the +first employee and invoke the "getAttributes()" method +on the Text Node. It should return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 +*/ +function hc_nodetextnodeattribute() { + var success; + if(checkInitialization(builder, "hc_nodetextnodeattribute") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + attrList = textNode.attributes; + + assertNull("text_attributes_is_null",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html new file mode 100644 index 0000000000..ad82a90098 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodename.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodetextnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodetextnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + Text Node is "#text". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function hc_nodetextnodename() { + var success; + if(checkInitialization(builder, "hc_nodetextnodename") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var textName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + textName = textNode.nodeName; + + assertEquals("textNodeName","#text",textName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html new file mode 100644 index 0000000000..6972e75d85 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodetype.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodetextnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodetextnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getNodeType()" method for a Text Node + + returns the constant value 3. + + + + Retrieve the Text node from the last child of + + the first employee and invoke the "getNodeType()" + + method. The method should return 3. + + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function hc_nodetextnodetype() { + var success; + if(checkInitialization(builder, "hc_nodetextnodetype") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + nodeType = textNode.nodeType; + + assertEquals("nodeTextNodeTypeAssert1",3,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html new file mode 100644 index 0000000000..2d3fceaad8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodetextnodevalue.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodetextnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodetextnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Text Node is the content of the Text node. + + Retrieve the Text node from the last child of the first + employee and check the string returned by the + "getNodeValue()" method. It should be equal to + "1230 North Ave. Dallas, Texas 98551". + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function hc_nodetextnodevalue() { + var success; + if(checkInitialization(builder, "hc_nodetextnodevalue") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var textValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + textValue = textNode.nodeValue; + + assertEquals("textNodeValue","1230 North Ave. Dallas, Texas 98551",textValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodetextnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html new file mode 100644 index 0000000000..5514287b2f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue01.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue01</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue01'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An element is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +*/ +function hc_nodevalue01() { + var success; + if(checkInitialization(builder, "hc_nodevalue01") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newNode = doc.createElement("acronym"); + newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html new file mode 100644 index 0000000000..4e48ceca84 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue02.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue02</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue02'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An comment is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +*/ +function hc_nodevalue02() { + var success; + if(checkInitialization(builder, "hc_nodevalue02") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newNode = doc.createComment("This is a new Comment node"); + newValue = newNode.nodeValue; + + assertEquals("initial","This is a new Comment node",newValue); + newNode.nodeValue = "This should have an effect"; + + newValue = newNode.nodeValue; + + assertEquals("afterChange","This should have an effect",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html new file mode 100644 index 0000000000..a661fd95f4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue03.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue03</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue03'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An entity reference is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490 +*/ +function hc_nodevalue03() { + var success; + if(checkInitialization(builder, "hc_nodevalue03") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + if( + + (builder.contentType == "text/html") + + ) { + + { + success = false; + try { + newNode = doc.createEntityReference("ent1"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + + } + + else { + newNode = doc.createEntityReference("ent1"); + assertNotNull("createdEntRefNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html new file mode 100644 index 0000000000..a921d8e1b4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue04.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue04</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue04'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 +*/ +function hc_nodevalue04() { + var success; + if(checkInitialization(builder, "hc_nodevalue04") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newNode = doc.doctype; + + assertTrue("docTypeNotNullOrDocIsHTML", + + ( + (newNode != null) + || + (builder.contentType == "text/html") +) +); + + if( + + (newNode != null) + + ) { + assertNotNull("docTypeNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html new file mode 100644 index 0000000000..8cb3e511d8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue05.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue05</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue05'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function hc_nodevalue05() { + var success; + if(checkInitialization(builder, "hc_nodevalue05") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + newNode = doc.createDocumentFragment(); + newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html new file mode 100644 index 0000000000..ad9454846e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue06.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue06</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var newNodeRef = null; + if (typeof(this.newNode) != 'undefined') { + newNodeRef = this.newNode; + } + docsLoaded += preload(newNodeRef, "newNode", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue06'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +*/ +function hc_nodevalue06() { + var success; + if(checkInitialization(builder, "hc_nodevalue06") != null) return; + var newNode; + var newValue; + + var newNodeRef = null; + if (typeof(this.newNode) != 'undefined') { + newNodeRef = this.newNode; + } + newNode = load(newNodeRef, "newNode", "hc_staff"); + newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="newNode" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html new file mode 100644 index 0000000000..7aa6d5baf5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue07.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue07</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue07'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An Entity is accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2 +*/ +function hc_nodevalue07() { + var success; + if(checkInitialization(builder, "hc_nodevalue07") != null) return; + var doc; + var newNode; + var newValue; + var nodeMap; + var docType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +nodeMap = docType.entities; + + assertNotNull("entitiesNotNull",nodeMap); +newNode = nodeMap.getNamedItem("alpha"); + assertNotNull("entityNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(builder.contentType, "text/html", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html new file mode 100644 index 0000000000..82b3ab458a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_nodevalue08.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue08</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_nodevalue08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_nodevalue08'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An notation is accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5431D1B9 +*/ +function hc_nodevalue08() { + var success; + if(checkInitialization(builder, "hc_nodevalue08") != null) return; + var doc; + var docType; + var newNode; + var newValue; + var nodeMap; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +nodeMap = docType.notations; + + assertNotNull("notationsNotNull",nodeMap); +newNode = nodeMap.getNamedItem("notation1"); + assertNotNull("notationNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(builder.contentType, "text/html", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodevalue08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html new file mode 100644 index 0000000000..5a7004f030 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_notationsremovenameditem1.html @@ -0,0 +1,153 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationsremovenameditem1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_notationsremovenameditem1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_notationsremovenameditem1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An attempt to add remove an notation should result in a NO_MODIFICATION_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +*/ +function hc_notationsremovenameditem1() { + var success; + if(checkInitialization(builder, "hc_notationsremovenameditem1") != null) return; + var doc; + var notations; + var docType; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); + + { + success = false; + try { + retval = notations.removeNamedItem("notation1"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(builder.contentType, "text/html", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationsremovenameditem1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html b/dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html new file mode 100644 index 0000000000..0cce1240eb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_notationssetnameditem1.html @@ -0,0 +1,164 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationssetnameditem1</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_notationssetnameditem1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("XML", null); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_notationssetnameditem1'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An attempt to add an element to the named node map returned by notations should +result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +*/ +function hc_notationssetnameditem1() { + var success; + if(checkInitialization(builder, "hc_notationssetnameditem1") != null) return; + var doc; + var notations; + var docType; + var retval; + var elem; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +elem = doc.createElement("br"); + + try { + retval = notations.setNamedItem(elem); + fail("throw_HIER_OR_NO_MOD_ERR"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* HIERARCHY_REQUEST_ERR */ 3 : + break; + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(builder.contentType, "text/html", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_notationssetnameditem1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html new file mode 100644 index 0000000000..1eab284fb1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerrnegativeoffset.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerrnegativeoffset</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textindexsizeerrnegativeoffset']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textindexsizeerrnegativeoffset'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset is + negative. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The desired exception should be raised since the offset + is a negative number. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function hc_textindexsizeerrnegativeoffset() { + var success; + if(checkInitialization(builder, "hc_textindexsizeerrnegativeoffset") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + + { + success = false; + try { + splitNode = textNode.splitText(-69); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerrnegativeoffset</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html new file mode 100644 index 0000000000..b5971eb8be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textindexsizeerroffsetoutofbounds.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerroffsetoutofbounds</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textindexsizeerroffsetoutofbounds']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textindexsizeerroffsetoutofbounds'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset is + greater than the number of characters in the Text node. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The desired exception should be raised since the offset + is a greater than the number of characters in the Text + node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function hc_textindexsizeerroffsetoutofbounds() { + var success; + if(checkInitialization(builder, "hc_textindexsizeerroffsetoutofbounds") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + + { + success = false; + try { + splitNode = textNode.splitText(300); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textindexsizeerroffsetoutofbounds</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html b/dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html new file mode 100644 index 0000000000..01bfcc43f7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textparseintolistofelements.html @@ -0,0 +1,185 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textparseintolistofelements</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textparseintolistofelements']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textparseintolistofelements'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the textual data from the last child of the + second employee. That node is composed of two + EntityReference nodes and two Text nodes. After + the content node is parsed, the "acronym" Element + should contain four children with each one of the + EntityReferences containing one child. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-745549614 +*/ +function hc_textparseintolistofelements() { + var success; + if(checkInitialization(builder, "hc_textparseintolistofelements") != null) return; + var doc; + var elementList; + var addressNode; + var childList; + var child; + var value; + var grandChild; + var length; + var result = new Array(); + + expectedNormal = new Array(); + expectedNormal[0] = "β"; + expectedNormal[1] = " Dallas, "; + expectedNormal[2] = "γ"; + expectedNormal[3] = "\n 98554"; + + expectedExpanded = new Array(); + expectedExpanded[0] = "β Dallas, γ\n 98554"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + addressNode = elementList.item(1); + childList = addressNode.childNodes; + + length = childList.length; + + for(var indexN65660 = 0;indexN65660 < childList.length; indexN65660++) { + child = childList.item(indexN65660); + value = child.nodeValue; + + + if( + + (value == null) + + ) { + grandChild = child.firstChild; + + assertNotNull("grandChildNotNull",grandChild); +value = grandChild.nodeValue; + + result[result.length] = value; + + } + + else { + result[result.length] = value; + + } + + } + + if( + (1 == length) + ) { + assertEqualsList("assertEqCoalescing",expectedExpanded,result); + + } + + else { + assertEqualsList("assertEqNormal",expectedNormal,result); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textparseintolistofelements</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html new file mode 100644 index 0000000000..1e951a4834 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextfour.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextfour</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textsplittextfour']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textsplittextfour'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method returns the new Text node. + + Retrieve the textual data from the last child of the + first employee and invoke the "splitText(offset)" method. + The method should return the new Text node. The offset + value used for this test is 30. The "getNodeValue()" + method is called to check that the new node now contains + the characters at and after position 30. + (Starting count at 0) + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function hc_textsplittextfour() { + var success; + if(checkInitialization(builder, "hc_textsplittextfour") != null) return; + var doc; + var elementList; + var addressNode; + var textNode; + var splitNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("acronym"); + addressNode = elementList.item(0); + textNode = addressNode.firstChild; + + splitNode = textNode.splitText(30); + value = splitNode.nodeValue; + + assertEquals("textSplitTextFourAssert","98551",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextfour</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html new file mode 100644 index 0000000000..05012317ad --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextone.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextone</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textsplittextone']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textsplittextone'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method breaks the Text node into + two Text nodes at the specified offset keeping each node + as siblings in the tree. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The method splits the Text node into two new sibling + Text nodes keeping both of them in the tree. This test + checks the "nextSibling()" method of the original node + to ensure that the two nodes are indeed siblings. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function hc_textsplittextone() { + var success; + if(checkInitialization(builder, "hc_textsplittextone") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + var secondPart; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + splitNode = textNode.splitText(7); + secondPart = textNode.nextSibling; + + value = secondPart.nodeValue; + + assertEquals("textSplitTextOneAssert","Jones",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextone</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html new file mode 100644 index 0000000000..f64334b3c1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittextthree.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextthree</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textsplittextthree']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textsplittextthree'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + After the "splitText(offset)" method breaks the Text node + into two Text nodes, the new Text node contains all the + content at and after the offset point. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The new Text node should contain all the content + at and after the offset point. The "getNodeValue()" + method is called to check that the new node now contains + the characters at and after position seven. + (Starting count at 0) + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function hc_textsplittextthree() { + var success; + if(checkInitialization(builder, "hc_textsplittextthree") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + splitNode = textNode.splitText(6); + value = splitNode.nodeValue; + + assertEquals("textSplitTextThreeAssert"," Jones",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittextthree</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html new file mode 100644 index 0000000000..ae7dc299e5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textsplittexttwo.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittexttwo</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textsplittexttwo']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textsplittexttwo'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + After the "splitText(offset)" method breaks the Text node + into two Text nodes, the original node contains all the + content up to the offset point. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The original Text node should contain all the content + up to the offset point. The "getNodeValue()" method + is called to check that the original node now contains + the first five characters. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function hc_textsplittexttwo() { + var success; + if(checkInitialization(builder, "hc_textsplittexttwo") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + splitNode = textNode.splitText(5); + value = textNode.nodeValue; + + assertEquals("textSplitTextTwoAssert","Roger",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textsplittexttwo</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html b/dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html new file mode 100644 index 0000000000..5c4aa7b299 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_hc_textwithnomarkup.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textwithnomarkup</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hc_textwithnomarkup']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "hc_staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hc_textwithnomarkup'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If there is not any markup inside an Element or Attr node + content, then the text is contained in a single object + implementing the Text interface that is the only child + of the element. + + Retrieve the textual data from the second child of the + third employee. That Text node contains a block of + multiple text lines without markup, so they should be + treated as a single Text node. The "getNodeValue()" + method should contain the combination of the two lines. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function hc_textwithnomarkup() { + var success; + if(checkInitialization(builder, "hc_textwithnomarkup") != null) return; + var doc; + var elementList; + var nameNode; + var nodeV; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("strong"); + nameNode = elementList.item(2); + nodeV = nameNode.firstChild; + + value = nodeV.nodeValue; + + assertEquals("textWithNoMarkupAssert","Roger\n Jones",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_textwithnomarkup</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +<iframe name="doc" src="files/hc_staff.html"></iframe> +<br> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html new file mode 100644 index 0000000000..f3d1fb6ed7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapchildnoderange.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapchildnoderange</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapchildnoderange']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapchildnoderange'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The range of valid child node indices is 0 to Length -1. + + Create a NamedNodeMap object from the attributes of the + last child of the third employee and traverse the + list from index 0 thru length -1. All indices should + be valid. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E +*/ +function namednodemapchildnoderange() { + var success; + if(checkInitialization(builder, "namednodemapchildnoderange") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var child; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + length = attributes.length; + + assertEquals("length",2,length); + child = attributes.item(0); + child = attributes.item(1); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapchildnoderange</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html new file mode 100644 index 0000000000..71764c14d2 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapgetnameditem.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapgetnameditem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNamedItem(name)" method retrieves a node + specified by name. + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getNamedItem(name)" + method is done with name="domestic". This should result + in the domestic Attr node being returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapgetnameditem() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditem") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var domesticAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + attrName = domesticAttr.nodeName; + + assertEquals("namednodemapGetNamedItemAssert","domestic",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapgetnameditem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html new file mode 100644 index 0000000000..b98d763ba1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapinuseattributeerr.html @@ -0,0 +1,154 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapinuseattributeerr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapinuseattributeerr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapinuseattributeerr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "setNamedItem(arg)" method raises a +INUSE_ATTRIBUTE_ERR DOMException if "arg" is an +Attr that is already in an attribute of another Element. + +Create a NamedNodeMap object from the attributes of the +last child of the third employee and attempt to add +an attribute that is already being used by the first +employee. This should raise the desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function namednodemapinuseattributeerr() { + var success; + if(checkInitialization(builder, "namednodemapinuseattributeerr") != null) return; + var doc; + var elementList; + var firstNode; + var testNode; + var attributes; + var domesticAttr; + var setAttr; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + firstNode = elementList.item(0); + domesticAttr = doc.createAttribute("domestic"); + domesticAttr.value = "Yes"; + + setAttr = firstNode.setAttributeNode(domesticAttr); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(2); + attributes = testNode.attributes; + + + { + success = false; + try { + setNode = attributes.setNamedItem(domesticAttr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("throw_INUSE_ATTRIBUTE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapinuseattributeerr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html new file mode 100644 index 0000000000..cd6a4a4c7b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapnotfounderr.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnotfounderr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapnotfounderr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapnotfounderr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeNamedItem(name)" method raises a + NOT_FOUND_ERR DOMException if there is not a node + named "name" in the map. + + Create a NamedNodeMap object from the attributes of the + last child of the third employee and attempt to remove + the "district" attribute. There is not a node named + "district" in the list and therefore the desired + exception should be raised. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +*/ +function namednodemapnotfounderr() { + var success; + if(checkInitialization(builder, "namednodemapnotfounderr") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + + { + success = false; + try { + removedNode = attributes.removeNamedItem("district"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnotfounderr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html new file mode 100644 index 0000000000..883d9b213e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapnumberofnodes.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnumberofnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapnumberofnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapnumberofnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of nodes + in the map. + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getLength()" + method is executed. The number of nodes should be 2. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E +*/ +function namednodemapnumberofnodes() { + var success; + if(checkInitialization(builder, "namednodemapnumberofnodes") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + length = attributes.length; + + assertEquals("length",2,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapnumberofnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html new file mode 100644 index 0000000000..72234b87fc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditem.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeNamedItem(name)" method removes a node + specified by name. + + Retrieve the third employee and create a NamedNodeMap + object of the attributes of the last child. Once the + list is created invoke the "removeNamedItem(name)" + method with name="street". This should result + in the removal of the specified attribute and + the "getSpecified()" method should return false. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function namednodemapremovenameditem() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditem") != null) return; + var doc; + var elementList; + var testAddress; + var attributes; + var streetAttr; + var specified; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(2); + attributes = testAddress.attributes; + + assertNotNull("attributesNotNull",attributes); +removedNode = attributes.removeNamedItem("street"); + streetAttr = attributes.getNamedItem("street"); + assertNotNull("streetAttrNotNull",streetAttr); +specified = streetAttr.specified; + + assertFalse("attrNotSpecified",specified); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html new file mode 100644 index 0000000000..565ad92c1b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemgetvalue.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemgetvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemgetvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemgetvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the node removed by the "removeNamedItem(name)" method + is an Attr node with a default value it is immediately + replaced. + + Retrieve the third employee and create a NamedNodeMap + object of the attributes of the last child. Once the + list is created invoke the "removeNamedItem(name)" + method with name="street". The "removeNamedItem(name)" + method should remove the "street" attribute and since + it has a default value of "Yes", that value should + immediately be the attributes value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +* @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html +*/ +function namednodemapremovenameditemgetvalue() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemgetvalue") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var streetAttr; + var value; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(2); + attributes = testEmployee.attributes; + + assertNotNull("attributesNotNull",attributes); +removedNode = attributes.removeNamedItem("street"); + streetAttr = attributes.getNamedItem("street"); + assertNotNull("streetAttrNotNull",streetAttr); +value = streetAttr.value; + + assertEquals("namednodemapRemoveNamedItemGetValueAssert","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemgetvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html new file mode 100644 index 0000000000..11a51c8bd1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapremovenameditemreturnnodevalue.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemreturnnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemreturnnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemreturnnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeNamedItem(name)" method returns the node + removed from the map. + + Retrieve the third employee and create a NamedNodeMap + object of the attributes of the last child. Once the + list is created invoke the "removeNamedItem(name)" + method with name="street". The "removeNamedItem(name)" + method should remove the existing "street" attribute + and return it. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapremovenameditemreturnnodevalue() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemreturnnodevalue") != null) return; + var doc; + var elementList; + var testAddress; + var attributes; + var removedNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(2); + attributes = testAddress.attributes; + + removedNode = attributes.removeNamedItem("street"); + value = removedNode.nodeValue; + + assertEquals("namednodemapRemoveNamedItemReturnNodeValueAssert","No",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemreturnnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html new file mode 100644 index 0000000000..45e1ae7d2c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnattrnode.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnattrnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapreturnattrnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapreturnattrnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNamedItem(name)" method returns a node of any + type specified by name. + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getNamedItem(name)" + method is done with name="street". This should result + in the method returning an Attr node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 +*/ +function namednodemapreturnattrnode() { + var success; + if(checkInitialization(builder, "namednodemapreturnattrnode") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var streetAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + streetAttr = attributes.getNamedItem("street"); + assertInstanceOf("typeAssert","Attr",streetAttr); +attrName = streetAttr.nodeName; + + assertEquals("nodeName","street",attrName); + attrName = streetAttr.name; + + assertEquals("attrName","street",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnattrnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html new file mode 100644 index 0000000000..d147a0725c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnfirstitem.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnfirstitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapreturnfirstitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapreturnfirstitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "item(index)" method returns the indexth item in + the map(test for first item). + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Since the + DOM does not specify an order of these nodes the contents + of the FIRST node can contain either "domestic" or "street". + The test should return "true" if the FIRST node is either + of these values. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapreturnfirstitem() { + var success; + if(checkInitialization(builder, "namednodemapreturnfirstitem") != null) return; + var doc; + var elementList; + var testAddress; + var attributes; + var child; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + attributes = testAddress.attributes; + + child = attributes.item(0); + name = child.nodeName; + + assertTrue("namednodemapReturnFirstItemAssert", + + (("domestic" == name) || ("street" == name)) +); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnfirstitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html new file mode 100644 index 0000000000..2bae176c3c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnlastitem.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnlastitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapreturnlastitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapreturnlastitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "item(index)" method returns the indexth item in + the map(test for last item). + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Since the + DOM does not specify an order of these nodes the contents + of the LAST node can contain either "domestic" or "street". + The test should return "true" if the LAST node is either + of these values. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapreturnlastitem() { + var success; + if(checkInitialization(builder, "namednodemapreturnlastitem") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var child; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + child = attributes.item(1); + name = child.nodeName; + + assertTrue("namednodemapReturnLastItemAssert", + + (("domestic" == name) || ("street" == name)) +); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnlastitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html new file mode 100644 index 0000000000..5150dc5a21 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapreturnnull.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapreturnnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapreturnnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNamedItem(name)" method returns null of the + specified name did not identify any node in the map. + + Retrieve the second employee and create a NamedNodeMap + listing of the attributes of the last child. Once the + list is created an invocation of the "getNamedItem(name)" + method is done with name="district". This name does not + match any names in the list therefore the method should + return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 +*/ +function namednodemapreturnnull() { + var success; + if(checkInitialization(builder, "namednodemapreturnnull") != null) return; + var doc; + var elementList; + var testEmployee; + var attributes; + var districtNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + districtNode = attributes.getNamedItem("district"); + assertNull("namednodemapReturnNullAssert",districtNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html new file mode 100644 index 0000000000..e0be9d0935 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditem.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNamedItem(arg)" method adds a node using its + nodeName attribute. + + Retrieve the second employee and create a NamedNodeMap + object from the attributes of the last child by + invoking the "getAttributes()" method. Once the + list is created an invocation of the "setNamedItem(arg)" + method is done with arg=newAttr, where newAttr is a + new Attr Node previously created. The "setNamedItem(arg)" + method should add then new node to the NamedNodeItem + object by using its "nodeName" attribute("district'). + This node is then retrieved using the "getNamedItem(name)" + method. This test uses the "createAttribute(name)" + method from the document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapsetnameditem() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditem") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var districtNode; + var attrName; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + newAttribute = doc.createAttribute("district"); + attributes = testAddress.attributes; + + setNode = attributes.setNamedItem(newAttribute); + districtNode = attributes.getNamedItem("district"); + attrName = districtNode.nodeName; + + assertEquals("namednodemapSetNamedItemAssert","district",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html new file mode 100644 index 0000000000..5f4c5d6b04 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemreturnvalue.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemreturnvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemreturnvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemreturnvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "setNamedItem(arg)" method replaces an already + existing node with the same name then the already + existing node is returned. + + Retrieve the third employee and create a NamedNodeMap + object from the attributes of the last child by + invoking the "getAttributes()" method. Once the + list is created an invocation of the "setNamedItem(arg)" + method is done with arg=newAttr, where newAttr is a + new Attr Node previously created and whose node name + already exists in the map. The "setNamedItem(arg)" + method should replace the already existing node with + the new one and return the existing node. + This test uses the "createAttribute(name)" method from + the document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapsetnameditemreturnvalue() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemreturnvalue") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var newNode; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(2); + newAttribute = doc.createAttribute("street"); + attributes = testAddress.attributes; + + newNode = attributes.setNamedItem(newAttribute); + attrValue = newNode.nodeValue; + + assertEquals("returnedNodeValue","No",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemreturnvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html new file mode 100644 index 0000000000..4b41834d2e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemthatexists.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemthatexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemthatexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemthatexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the node to be added by the "setNamedItem(arg)" method + already exists in the NamedNodeMap, it is replaced by + the new one. + + Retrieve the second employee and create a NamedNodeMap + object from the attributes of the last child by + invoking the "getAttributes()" method. Once the + list is created an invocation of the "setNamedItem(arg)" + method is done with arg=newAttr, where newAttr is a + new Attr Node previously created and whose node name + already exists in the map. The "setNamedItem(arg)" + method should replace the already existing node with + the new one. + This node is then retrieved using the "getNamedItem(name)" + method. This test uses the "createAttribute(name)" + method from the document interface + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapsetnameditemthatexists() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemthatexists") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var districtNode; + var attrValue; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + newAttribute = doc.createAttribute("street"); + attributes = testAddress.attributes; + + setNode = attributes.setNamedItem(newAttribute); + districtNode = attributes.getNamedItem("street"); + attrValue = districtNode.nodeValue; + + assertEquals("streetValue","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemthatexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html new file mode 100644 index 0000000000..c8ecc479b3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapsetnameditemwithnewvalue.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemwithnewvalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemwithnewvalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemwithnewvalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "setNamedItem(arg)" method does not replace an + existing node with the same name then it returns null. + + Retrieve the third employee and create a NamedNodeMap + object from the attributes of the last child. + Once the list is created the "setNamedItem(arg)" method + is invoked with arg=newAttr, where newAttr is a + newly created Attr Node and whose node name + already exists in the map. The "setNamedItem(arg)" + method should add the new node and return null. + This test uses the "createAttribute(name)" method from + the document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 +*/ +function namednodemapsetnameditemwithnewvalue() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemwithnewvalue") != null) return; + var doc; + var elementList; + var newAttribute; + var testAddress; + var attributes; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(2); + newAttribute = doc.createAttribute("district"); + attributes = testAddress.attributes; + + newNode = attributes.setNamedItem(newAttribute); + assertNull("returnedNodeNull",newNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemwithnewvalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html b/dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html new file mode 100644 index 0000000000..7fe35dc8b1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_namednodemapwrongdocumenterr.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapwrongdocumenterr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapwrongdocumenterr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapwrongdocumenterr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNamedItem(arg)" method raises a + WRONG_DOCUMENT_ERR DOMException if "arg" was created + from a different document than the one that created + the NamedNodeMap. + + Create a NamedNodeMap object from the attributes of the + last child of the third employee and attempt to add + another Attr node to it that was created from a + different DOM document. This should raise the desired + exception. This method uses the "createAttribute(name)" + method from the Document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function namednodemapwrongdocumenterr() { + var success; + if(checkInitialization(builder, "namednodemapwrongdocumenterr") != null) return; + var doc1; + var doc2; + var elementList; + var testAddress; + var attributes; + var newAttribute; + var setNode; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "staff"); + elementList = doc1.getElementsByTagName("address"); + testAddress = elementList.item(2); + newAttribute = doc2.createAttribute("newAttribute"); + attributes = testAddress.attributes; + + + { + success = false; + try { + setNode = attributes.setNamedItem(newAttribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapwrongdocumenterr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html new file mode 100644 index 0000000000..6a92521926 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchild.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method adds the node + "newChild" to the end of the list of children of the + node. + + Retrieve the second employee and append a new Element + node to the list of children. The last node in the list + is then retrieved and its NodeName examined. The + "getNodeName()" method should return "newChild". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function nodeappendchild() { + var success; + if(checkInitialization(builder, "nodeappendchild") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var createdNode; + var lchild; + var childName; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + createdNode = doc.createElement("newChild"); + appendedChild = employeeNode.appendChild(createdNode); + lchild = employeeNode.lastChild; + + childName = lchild.nodeName; + + assertEquals("nodeAppendChildAssert1","newChild",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html new file mode 100644 index 0000000000..0f18a1ac38 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildchildexists.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildchildexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildchildexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildchildexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is already in the tree, it is first + removed before the new one is appended. + + Retrieve the first child of the second employee and + append the first child to the end of the list. After + the "appendChild(newChild)" method is invoked the first + child should be the one that was second and the last + child should be the one that was first. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function nodeappendchildchildexists() { + var success; + if(checkInitialization(builder, "nodeappendchildchildexists") != null) return; + var doc; + var elementList; + var childNode; + var newChild; + var lchild; + var fchild; + var lchildName; + var fchildName; + var appendedChild; + var initialName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + childNode = elementList.item(1); + newChild = childNode.firstChild; + + initialName = newChild.nodeName; + + appendedChild = childNode.appendChild(newChild); + fchild = childNode.firstChild; + + fchildName = fchild.nodeName; + + lchild = childNode.lastChild; + + lchildName = lchild.nodeName; + + + if( + ("employeeId" == initialName) + ) { + assertEquals("assert1_nowhitespace","name",fchildName); + assertEquals("assert2_nowhitespace","employeeId",lchildName); + + } + + else { + assertEquals("assert1","employeeId",fchildName); + assertEquals("assert2","#text",lchildName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildchildexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html new file mode 100644 index 0000000000..f7ece16017 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchilddocfragment.html @@ -0,0 +1,168 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchilddocfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchilddocfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchilddocfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create and populate a new DocumentFragment object and + append it to the second employee. After the + "appendChild(newChild)" method is invoked retrieve the + new nodes at the end of the list, they should be the + two Element nodes from the DocumentFragment. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function nodeappendchilddocfragment() { + var success; + if(checkInitialization(builder, "nodeappendchilddocfragment") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var newdocFragment; + var newChild1; + var newChild2; + var child; + var childName; + var result = new Array(); + + var nodeType; + var appendedChild; + expected = new Array(); + expected[0] = "employeeId"; + expected[1] = "name"; + expected[2] = "position"; + expected[3] = "salary"; + expected[4] = "gender"; + expected[5] = "address"; + expected[6] = "newChild1"; + expected[7] = "newChild2"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + newdocFragment = doc.createDocumentFragment(); + newChild1 = doc.createElement("newChild1"); + newChild2 = doc.createElement("newChild2"); + appendedChild = newdocFragment.appendChild(newChild1); + appendedChild = newdocFragment.appendChild(newChild2); + appendedChild = employeeNode.appendChild(newdocFragment); + for(var indexN65695 = 0;indexN65695 < childList.length; indexN65695++) { + child = childList.item(indexN65695); + nodeType = child.nodeType; + + + if( + (1 == nodeType) + ) { + childName = child.nodeName; + + result[result.length] = childName; + + } + + } + assertEqualsList("elementNames",expected,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchilddocfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html new file mode 100644 index 0000000000..3b0a3e3a93 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildgetnodename.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildgetnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildgetnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildgetnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method returns the node + added. + + Append a newly created node to the child list of the + second employee and check the NodeName returned. The + "getNodeName()" method should return "newChild". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function nodeappendchildgetnodename() { + var success; + if(checkInitialization(builder, "nodeappendchildgetnodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var newChild; + var appendNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + newChild = doc.createElement("newChild"); + appendNode = employeeNode.appendChild(newChild); + childName = appendNode.nodeName; + + assertEquals("nodeAppendChildGetNodeNameAssert1","newChild",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildgetnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html new file mode 100644 index 0000000000..a044492082 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildinvalidnodetype.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildinvalidnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildinvalidnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildinvalidnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if this node is of + a type that does not allow children of the type "newChild" + to be inserted. + + Retrieve the root node and attempt to append a newly + created Attr node. An Element node cannot have children + of the "Attr" type, therefore the desired exception + should be raised. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodeappendchildinvalidnodetype() { + var success; + if(checkInitialization(builder, "nodeappendchildinvalidnodetype") != null) return; + var doc; + var rootNode; + var newChild; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + rootNode = doc.documentElement; + + newChild = doc.createAttribute("newAttribute"); + + { + success = false; + try { + appendedChild = rootNode.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildinvalidnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html new file mode 100644 index 0000000000..402fdc32c5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnewchilddiffdocument.html @@ -0,0 +1,159 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnewchilddiffdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildnewchilddiffdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildnewchilddiffdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method raises a + WRONG_DOCUMENT_ERR DOMException if the "newChild" was + created from a different document than the one that + created this node. + + Retrieve the second employee and attempt to append + a node created from a different document. An attempt + to make such a replacement should raise the desired + exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodeappendchildnewchilddiffdocument() { + var success; + if(checkInitialization(builder, "nodeappendchildnewchilddiffdocument") != null) return; + var doc1; + var doc2; + var newChild; + var elementList; + var elementNode; + var appendedChild; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "staff"); + newChild = doc1.createElement("newChild"); + elementList = doc2.getElementsByTagName("employee"); + elementNode = elementList.item(1); + + { + success = false; + try { + appendedChild = elementNode.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnewchilddiffdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html new file mode 100644 index 0000000000..350ff083fa --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnodeancestor.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnodeancestor</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildnodeancestor']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildnodeancestor'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if the node to + append is one of this node's ancestors. + + Retrieve the second employee and attempt to append + an ancestor node(root node) to it. + An attempt to make such an addition should raise the + desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodeappendchildnodeancestor() { + var success; + if(checkInitialization(builder, "nodeappendchildnodeancestor") != null) return; + var doc; + var newChild; + var elementList; + var employeeNode; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newChild = doc.documentElement; + + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + + { + success = false; + try { + appendedChild = employeeNode.appendChild(newChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnodeancestor</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html new file mode 100644 index 0000000000..1e6d34cbd6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederr.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildnomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildnomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "appendChild(newChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function nodeappendchildnomodificationallowederr() { + var success; + if(checkInitialization(builder, "nodeappendchildnomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entRef; + var entElement; + var createdNode; + var appendedNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entRef = genderNode.firstChild; + + assertNotNull("entRefNotNull",entRef); +nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +createdNode = doc.createElement("text3"); + + { + success = false; + try { + appendedNode = entElement.appendChild(createdNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html new file mode 100644 index 0000000000..57f1730eba --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeappendchildnomodificationallowederrEE.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeappendchildnomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeappendchildnomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "appendChild(newChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an ent4 entity reference and the "appendChild(newChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederr.xml +*/ +function nodeappendchildnomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "nodeappendchildnomodificationallowederrEE") != null) return; + var doc; + var entRef; + var createdNode; + var appendedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +createdNode = doc.createElement("text3"); + + { + success = false; + try { + appendedNode = entRef.appendChild(createdNode); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildnomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html new file mode 100644 index 0000000000..3a35eaef28 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodeattribute.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeattributenodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeattributenodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on an Attribute +Node returns null. + +Retrieve the first attribute from the last child of the +first employee and invoke the "getAttributes()" method +on the Attribute Node. It should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 +*/ +function nodeattributenodeattribute() { + var success; + if(checkInitialization(builder, "nodeattributenodeattribute") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + addrAttr = testAddr.attributes; + + attrNode = addrAttr.item(0); + attrList = attrNode.attributes; + + assertNull("nodeAttributeNodeAttributeAssert1",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html new file mode 100644 index 0000000000..f62adb4f17 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodename.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeattributenodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeattributenodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The string returned by the "getNodeName()" method for an + + Attribute Node is the name of the Attribute. + + + + Retrieve the Attribute named "domestic" from the last + + child of the first employee and check the string returned + + by the "getNodeName()" method. It should be equal to + + "domestic". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodeattributenodename() { + var success; + if(checkInitialization(builder, "nodeattributenodename") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNode("domestic"); + attrName = addrAttr.nodeName; + + assertEquals("nodeAttributeNodeNameAssert1","domestic",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html new file mode 100644 index 0000000000..3b5b4e492b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodetype.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeattributenodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeattributenodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getNodeType()" method for an Attribute Node + + returns the constant value 2. + + + + Retrieve the first attribute from the last child of + + the first employee and invoke the "getNodeType()" + + method. The method should return 2. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodeattributenodetype() { + var success; + if(checkInitialization(builder, "nodeattributenodetype") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNode("domestic"); + nodeType = addrAttr.nodeType; + + assertEquals("nodeAttrNodeTypeAssert1",2,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html new file mode 100644 index 0000000000..9a90ed90c3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeattributenodevalue.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeattributenodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeattributenodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The string returned by the "getNodeValue()" method for an + + Attribute Node is the value of the Attribute. + + + + Retrieve the Attribute named "domestic" from the last + + child of the first employee and check the string returned + + by the "getNodeValue()" method. It should be equal to + + "Yes". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodeattributenodevalue() { + var success; + if(checkInitialization(builder, "nodeattributenodevalue") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNode("domestic"); + attrValue = addrAttr.nodeValue; + + assertEquals("nodeAttributeNodeValueAssert1","Yes",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeattributenodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html new file mode 100644 index 0000000000..da9d1323b9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodeattribute.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecdatasectionnodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecdatasectionnodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on a CDATASection +Node returns null. + +Retrieve the CDATASection node contained inside the +second child of the second employee and invoke the +"getAttributes()" method on the CDATASection node. +It should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212 +*/ +function nodecdatasectionnodeattribute() { + var success; + if(checkInitialization(builder, "nodecdatasectionnodeattribute") != null) return; + var doc; + var elementList; + var cdataName; + var cdataNode; + var attrList; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + cdataName = elementList.item(1); + cdataNode = cdataName.lastChild; + + nodeType = cdataNode.nodeType; + + + if( + !(4 == nodeType) + ) { + cdataNode = doc.createCDATASection(""); + + } + attrList = cdataNode.attributes; + + assertNull("cdataSection",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html new file mode 100644 index 0000000000..d339553d8c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodename.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecdatasectionnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecdatasectionnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + CDATASection Node is #cdata-section". + + Retrieve the CDATASection node inside the second child + of the second employee and check the string returned + by the "getNodeName()" method. It should be equal to + "#cdata-section". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212 +*/ +function nodecdatasectionnodename() { + var success; + if(checkInitialization(builder, "nodecdatasectionnodename") != null) return; + var doc; + var elementList; + var cdataName; + var cdataNode; + var nodeType; + var cdataNodeName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + cdataName = elementList.item(1); + cdataNode = cdataName.lastChild; + + nodeType = cdataNode.nodeType; + + + if( + !(4 == nodeType) + ) { + cdataNode = doc.createCDATASection(""); + + } + cdataNodeName = cdataNode.nodeName; + + assertEquals("cdataNodeName","#cdata-section",cdataNodeName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html new file mode 100644 index 0000000000..3b0b799607 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodetype.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecdatasectionnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("coalescing", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecdatasectionnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for a CDATASection Node + returns the constant value 4. + + Retrieve the CDATASection node contained inside the + second child of the second employee and invoke the + "getNodeType()" method. The method should return 4. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212 +*/ +function nodecdatasectionnodetype() { + var success; + if(checkInitialization(builder, "nodecdatasectionnodetype") != null) return; + var doc; + var elementList; + var testName; + var cdataNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + testName = elementList.item(1); + cdataNode = testName.lastChild; + + nodeType = cdataNode.nodeType; + + + if( + (3 == nodeType) + ) { + cdataNode = doc.createCDATASection(""); + nodeType = cdataNode.nodeType; + + + } + assertEquals("nodeTypeCDATA",4,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html new file mode 100644 index 0000000000..5cec6dc002 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecdatasectionnodevalue.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecdatasectionnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("coalescing", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecdatasectionnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + CDATASection Node is the content of the CDATASection. + + Retrieve the CDATASection node inside the second child + of the second employee and check the string returned + by the "getNodeValue()" method. It should be equal to + "This is a CDATA Section with EntityReference number 2 + &ent2;". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-667469212 +*/ +function nodecdatasectionnodevalue() { + var success; + if(checkInitialization(builder, "nodecdatasectionnodevalue") != null) return; + var doc; + var elementList; + var cdataName; + var childList; + var child; + var cdataNodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + cdataName = elementList.item(1); + childList = cdataName.childNodes; + + child = childList.item(1); + + if( + + (child == null) + + ) { + child = doc.createCDATASection("This is a CDATASection with EntityReference number 2 &ent2;"); + + } + cdataNodeValue = child.nodeValue; + + assertEquals("value","This is a CDATASection with EntityReference number 2 &ent2;",cdataNodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html b/dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html new file mode 100644 index 0000000000..66a9fe8101 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodechildnodes.html @@ -0,0 +1,152 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodechildnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodechildnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Collect the element names from Node.childNodes and check against expectations. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +*/ +function nodechildnodes() { + var success; + if(checkInitialization(builder, "nodechildnodes") != null) return; + var doc; + var elementList; + var employeeNode; + var childNodes; + var childNode; + var childType; + var childName; + var elementNames = new Array(); + + expectedElementNames = new Array(); + expectedElementNames[0] = "employeeId"; + expectedElementNames[1] = "name"; + expectedElementNames[2] = "position"; + expectedElementNames[3] = "salary"; + expectedElementNames[4] = "gender"; + expectedElementNames[5] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childNodes = employeeNode.childNodes; + + for(var indexN65644 = 0;indexN65644 < childNodes.length; indexN65644++) { + childNode = childNodes.item(indexN65644); + childType = childNode.nodeType; + + + if( + (1 == childType) + ) { + childName = childNode.nodeName; + + elementNames[elementNames.length] = childName; + + } + + } + assertEqualsList("elementNames",expectedElementNames,elementNames); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html new file mode 100644 index 0000000000..53d00b5aa3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesappendchild.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesappendchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodechildnodesappendchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodechildnodesappendchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Add an element and check that the previously retrieved childNodes NodeList +is live. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 +*/ +function nodechildnodesappendchild() { + var success; + if(checkInitialization(builder, "nodechildnodesappendchild") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var createdNode; + var expectedLength; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + expectedLength = childList.length; + + expectedLength += 1; +createdNode = doc.createElement("text3"); + employeeNode = employeeNode.appendChild(createdNode); + length = childList.length; + + assertEquals("childNodeLength",expectedLength,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesappendchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html new file mode 100644 index 0000000000..81214fd47e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodechildnodesempty.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesempty</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodechildnodesempty']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodechildnodesempty'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getChildNodes()" method returns a NodeList + that contains all children of this node. If there + are not any children, this is a NodeList that does not + contain any nodes. + + Retrieve the Text node from the second child of the second + employee and invoke the "getChildNodes()" method. The + NodeList returned should not have any nodes. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +*/ +function nodechildnodesempty() { + var success; + if(checkInitialization(builder, "nodechildnodesempty") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var secondCNode; + var textNode; + var childNodesList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + secondCNode = childList.item(1); + textNode = secondCNode.firstChild; + + childNodesList = textNode.childNodes; + + assertSize("nodeChildNodesEmptyAssert1",0,childNodesList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodechildnodesempty</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html b/dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html new file mode 100644 index 0000000000..1f20d47bd1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecloneattributescopied.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecloneattributescopied</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecloneattributescopied']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecloneattributescopied'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the cloneNode method is used to clone an + Element node, all the attributes of the Element are + copied along with their values. + + Retrieve the last child of the second employee and invoke + the cloneNode method. The + duplicate node returned by the method should copy the + attributes associated with this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodecloneattributescopied() { + var success; + if(checkInitialization(builder, "nodecloneattributescopied") != null) return; + var doc; + var elementList; + var addressNode; + var clonedNode; + var attributes; + var attributeNode; + var attributeName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "domestic"; + expectedResult[1] = "street"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + addressNode = elementList.item(1); + clonedNode = addressNode.cloneNode(false); + attributes = clonedNode.attributes; + + for(var indexN65637 = 0;indexN65637 < attributes.length; indexN65637++) { + attributeNode = attributes.item(indexN65637); + attributeName = attributeNode.nodeName; + + result[result.length] = attributeName; + + } + assertEqualsCollection("nodeCloneAttributesCopiedAssert1",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecloneattributescopied</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html new file mode 100644 index 0000000000..1d5d510d61 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonefalsenocopytext.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonefalsenocopytext</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeclonefalsenocopytext']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeclonefalsenocopytext'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method does not copy text unless it + is deep cloned.(Test for deep=false) + + Retrieve the fourth child of the second employee and + the "cloneNode(deep)" method with deep=false. The + duplicate node returned by the method should not copy + any text data contained in this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function nodeclonefalsenocopytext() { + var success; + if(checkInitialization(builder, "nodeclonefalsenocopytext") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var childNode; + var clonedNode; + var lastChildNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + childNode = childList.item(3); + clonedNode = childNode.cloneNode(false); + lastChildNode = clonedNode.lastChild; + + assertNull("noTextNodes",lastChildNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonefalsenocopytext</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html new file mode 100644 index 0000000000..f9b78e1d32 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonegetparentnull.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonegetparentnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeclonegetparentnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeclonegetparentnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The duplicate node returned by the "cloneNode(deep)" + method does not have a ParentNode. + + Retrieve the second employee and invoke the + "cloneNode(deep)" method with deep=false. The + duplicate node returned should return null when the + "getParentNode()" is invoked. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function nodeclonegetparentnull() { + var success; + if(checkInitialization(builder, "nodeclonegetparentnull") != null) return; + var doc; + var elementList; + var employeeNode; + var clonedNode; + var parentNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + clonedNode = employeeNode.cloneNode(false); + parentNode = clonedNode.parentNode; + + assertNull("nodeCloneGetParentNullAssert1",parentNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonegetparentnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html new file mode 100644 index 0000000000..09c3994559 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodefalse.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodefalse</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeclonenodefalse']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeclonenodefalse'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method returns a copy of the node + only if deep=false. + + Retrieve the second employee and invoke the + "cloneNode(deep)" method with deep=false. The + method should only clone this node. The NodeName and + length of the NodeList are checked. The "getNodeName()" + method should return "employee" and the "getLength()" + method should return 0. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function nodeclonenodefalse() { + var success; + if(checkInitialization(builder, "nodeclonenodefalse") != null) return; + var doc; + var elementList; + var employeeNode; + var clonedNode; + var cloneName; + var cloneChildren; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + clonedNode = employeeNode.cloneNode(false); + cloneName = clonedNode.nodeName; + + assertEquals("name","employee",cloneName); + cloneChildren = clonedNode.childNodes; + + length = cloneChildren.length; + + assertEquals("length",0,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodefalse</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html new file mode 100644 index 0000000000..6a66b1f5b9 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonenodetrue.html @@ -0,0 +1,185 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodetrue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeclonenodetrue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeclonenodetrue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "cloneNode(deep)" method returns a copy of the node + and the subtree under it if deep=true. + + Retrieve the second employee and invoke the + "cloneNode(deep)" method with deep=true. The + method should clone this node and the subtree under it. + The NodeName of each child in the returned node is + checked to insure the entire subtree under the second + employee was cloned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function nodeclonenodetrue() { + var success; + if(checkInitialization(builder, "nodeclonenodetrue") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var clonedNode; + var clonedList; + var clonedChild; + var clonedChildName; + var length; + var result = new Array(); + + expectedWhitespace = new Array(); + expectedWhitespace[0] = "#text"; + expectedWhitespace[1] = "employeeId"; + expectedWhitespace[2] = "#text"; + expectedWhitespace[3] = "name"; + expectedWhitespace[4] = "#text"; + expectedWhitespace[5] = "position"; + expectedWhitespace[6] = "#text"; + expectedWhitespace[7] = "salary"; + expectedWhitespace[8] = "#text"; + expectedWhitespace[9] = "gender"; + expectedWhitespace[10] = "#text"; + expectedWhitespace[11] = "address"; + expectedWhitespace[12] = "#text"; + + expectedNoWhitespace = new Array(); + expectedNoWhitespace[0] = "employeeId"; + expectedNoWhitespace[1] = "name"; + expectedNoWhitespace[2] = "position"; + expectedNoWhitespace[3] = "salary"; + expectedNoWhitespace[4] = "gender"; + expectedNoWhitespace[5] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + length = childList.length; + + clonedNode = employeeNode.cloneNode(true); + clonedList = clonedNode.childNodes; + + for(var indexN65710 = 0;indexN65710 < clonedList.length; indexN65710++) { + clonedChild = clonedList.item(indexN65710); + clonedChildName = clonedChild.nodeName; + + result[result.length] = clonedChildName; + + } + + if( + (6 == length) + ) { + assertEqualsList("nowhitespace",expectedNoWhitespace,result); + + } + + else { + assertEqualsList("whitespace",expectedWhitespace,result); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodetrue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html b/dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html new file mode 100644 index 0000000000..defb3c8b39 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeclonetruecopytext.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonetruecopytext</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeclonetruecopytext']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeclonetruecopytext'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second salary and + the "cloneNode(deep)" method with deep=true. The + duplicate node returned by the method should copy + any text data contained in this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 +*/ +function nodeclonetruecopytext() { + var success; + if(checkInitialization(builder, "nodeclonetruecopytext") != null) return; + var doc; + var elementList; + var childList; + var childNode; + var clonedNode; + var lastChildNode; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("salary"); + childNode = elementList.item(1); + clonedNode = childNode.cloneNode(true); + lastChildNode = clonedNode.lastChild; + + childValue = lastChildNode.nodeValue; + + assertEquals("nodeCloneTrueCopyTextAssert1","35,000",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonetruecopytext</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html new file mode 100644 index 0000000000..b4030d6854 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodeattributes.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecommentnodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecommentnodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method invoked on a Comment + Node returns null. + + Find any comment that is an immediate child of the root + and assert that Node.attributes is null. Then create + a new comment node (in case they had been omitted) and + make the assertion. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 +*/ +function nodecommentnodeattributes() { + var success; + if(checkInitialization(builder, "nodecommentnodeattributes") != null) return; + var doc; + var childList; + var childNode; + var attrList; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + childList = doc.childNodes; + + for(var indexN65603 = 0;indexN65603 < childList.length; indexN65603++) { + childNode = childList.item(indexN65603); + nodeType = childNode.nodeType; + + + if( + (8 == nodeType) + ) { + attrList = childNode.attributes; + + assertNull("attributesNull",attrList); + + } + + } + childNode = doc.createComment("This is a comment"); + attrList = childNode.attributes; + + assertNull("createdAttributesNull",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html new file mode 100644 index 0000000000..062c3a989d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodename.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecommentnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecommentnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + Comment Node is "#comment". + + Retrieve the Comment node in the XML file + and check the string returned by the "getNodeName()" + method. It should be equal to "#comment". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +*/ +function nodecommentnodename() { + var success; + if(checkInitialization(builder, "nodecommentnodename") != null) return; + var doc; + var elementList; + var commentNode; + var nodeType; + var commentNodeName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.childNodes; + + for(var indexN65600 = 0;indexN65600 < elementList.length; indexN65600++) { + commentNode = elementList.item(indexN65600); + nodeType = commentNode.nodeType; + + + if( + (8 == nodeType) + ) { + commentNodeName = commentNode.nodeName; + + assertEquals("commentNodeName","#comment",commentNodeName); + + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html new file mode 100644 index 0000000000..4455d4e219 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodetype.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecommentnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecommentnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for a Comment Node + returns the constant value 8. + + Retrieve the nodes from the document and check for + a comment node and invoke the "getNodeType()" method. This should + return 8. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +*/ +function nodecommentnodetype() { + var success; + if(checkInitialization(builder, "nodecommentnodetype") != null) return; + var doc; + var testList; + var commentNode; + var commentNodeName; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + testList = doc.childNodes; + + for(var indexN65600 = 0;indexN65600 < testList.length; indexN65600++) { + commentNode = testList.item(indexN65600); + commentNodeName = commentNode.nodeName; + + + if( + ("#comment" == commentNodeName) + ) { + nodeType = commentNode.nodeType; + + assertEquals("nodeCommentNodeTypeAssert1",8,nodeType); + + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html new file mode 100644 index 0000000000..c99474b071 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodecommentnodevalue.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodecommentnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodecommentnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Comment Node is the content of the comment. + + Retrieve the comment in the XML file and + check the string returned by the "getNodeValue()" method. + It should be equal to "This is comment number 1". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +*/ +function nodecommentnodevalue() { + var success; + if(checkInitialization(builder, "nodecommentnodevalue") != null) return; + var doc; + var elementList; + var commentNode; + var commentName; + var commentValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.childNodes; + + for(var indexN65600 = 0;indexN65600 < elementList.length; indexN65600++) { + commentNode = elementList.item(indexN65600); + commentName = commentNode.nodeName; + + + if( + ("#comment" == commentName) + ) { + commentValue = commentNode.nodeValue; + + assertEquals("value"," This is comment number 1.",commentValue); + + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecommentnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html new file mode 100644 index 0000000000..8914268b84 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodename.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentfragmentnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentfragmentnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + DocumentFragment Node is "#document-frament". + + Retrieve the DOM document and invoke the + "createDocumentFragment()" method and check the string + returned by the "getNodeName()" method. It should be + equal to "#document-fragment". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function nodedocumentfragmentnodename() { + var success; + if(checkInitialization(builder, "nodedocumentfragmentnodename") != null) return; + var doc; + var docFragment; + var documentFragmentName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docFragment = doc.createDocumentFragment(); + documentFragmentName = docFragment.nodeName; + + assertEquals("nodeDocumentFragmentNodeNameAssert1","#document-fragment",documentFragmentName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html new file mode 100644 index 0000000000..0b23789595 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodetype.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentfragmentnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentfragmentnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for a DocumentFragment Node + returns the constant value 11. + + Invoke the "createDocumentFragment()" method and + examine the NodeType of the document fragment + returned by the "getNodeType()" method. The method + should return 11. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function nodedocumentfragmentnodetype() { + var success; + if(checkInitialization(builder, "nodedocumentfragmentnodetype") != null) return; + var doc; + var documentFragmentNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + documentFragmentNode = doc.createDocumentFragment(); + nodeType = documentFragmentNode.nodeType; + + assertEquals("nodeDocumentFragmentNodeTypeAssert1",11,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html new file mode 100644 index 0000000000..b3408632fe --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentfragmentnodevalue.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentfragmentnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentfragmentnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + DocumentFragment Node is null. + + Retrieve the DOM document and invoke the + "createDocumentFragment()" method and check the string + returned by the "getNodeValue()" method. It should be + equal to null. + +* @author NIST +* @author Mary Brady +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodedocumentfragmentnodevalue() { + var success; + if(checkInitialization(builder, "nodedocumentfragmentnodevalue") != null) return; + var doc; + var docFragment; + var attrList; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docFragment = doc.createDocumentFragment(); + attrList = docFragment.attributes; + + assertNull("attributesNull",attrList); + value = docFragment.nodeValue; + + assertNull("initiallyNull",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentfragmentnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html new file mode 100644 index 0000000000..afa8baad29 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodeattribute.html @@ -0,0 +1,122 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentnodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentnodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on a Document +Node returns null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +*/ +function nodedocumentnodeattribute() { + var success; + if(checkInitialization(builder, "nodedocumentnodeattribute") != null) return; + var doc; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + attrList = doc.attributes; + + assertNull("documentAttributesNull",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html new file mode 100644 index 0000000000..e2084935bd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodename.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + Document Node is "#document". + + Retrieve the DOM document and check the string returned + by the "getNodeName()" method. It should be equal to + "#document". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodedocumentnodename() { + var success; + if(checkInitialization(builder, "nodedocumentnodename") != null) return; + var doc; + var documentName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + documentName = doc.nodeName; + + assertEquals("documentNodeName","#document",documentName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html new file mode 100644 index 0000000000..e6a6548358 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodetype.html @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getNodeType()" method for a Document Node +returns the constant value 9. + +Retrieve the document and invoke the "getNodeType()" +method. The method should return 9. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodedocumentnodetype() { + var success; + if(checkInitialization(builder, "nodedocumentnodetype") != null) return; + var doc; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + nodeType = doc.nodeType; + + assertEquals("nodeDocumentNodeTypeAssert1",9,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html new file mode 100644 index 0000000000..783847ecfd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumentnodevalue.html @@ -0,0 +1,127 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumentnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumentnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Document Node is null. + + Retrieve the DOM Document and check the string returned + by the "getNodeValue()" method. It should be equal to + null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodedocumentnodevalue() { + var success; + if(checkInitialization(builder, "nodedocumentnodevalue") != null) return; + var doc; + var documentValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + documentValue = doc.nodeValue; + + assertNull("documentNodeValueNull",documentValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumentnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html new file mode 100644 index 0000000000..0346fce8bc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodename.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumenttypenodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumenttypenodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the DOCTYPE declaration from the XML file and + check the string returned by the "getNodeName()" + method. It should be equal to "staff" or "svg". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodedocumenttypenodename() { + var success; + if(checkInitialization(builder, "nodedocumenttypenodename") != null) return; + var doc; + var docType; + var documentTypeName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +documentTypeName = docType.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("doctypeNameSVG","svg",documentTypeName); + + } + + else { + assertEquals("documentName","staff",documentTypeName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html new file mode 100644 index 0000000000..914e2ee8ae --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodetype.html @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumenttypenodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumenttypenodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for a DocumentType Node + returns the constant value 10. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodedocumenttypenodetype() { + var success; + if(checkInitialization(builder, "nodedocumenttypenodetype") != null) return; + var doc; + var documentTypeNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + documentTypeNode = doc.doctype; + + assertNotNull("doctypeNotNull",documentTypeNode); +nodeType = documentTypeNode.nodeType; + + assertEquals("nodeType",10,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html new file mode 100644 index 0000000000..021dc8e59c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodedocumenttypenodevalue.html @@ -0,0 +1,124 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodedocumenttypenodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodedocumenttypenodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + DocumentType Node is null. + +* @author NIST +* @author Mary Brady +*/ +function nodedocumenttypenodevalue() { + var success; + if(checkInitialization(builder, "nodedocumenttypenodevalue") != null) return; + var doc; + var docType; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +attrList = docType.attributes; + + assertNull("doctypeAttributesNull",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodedocumenttypenodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html new file mode 100644 index 0000000000..4cd9bbc39d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodeattributes.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeelementnodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeelementnodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method invoked on an Element + Node returns a NamedNodeMap containing the attributes + of this node. + + Retrieve the last child of the third employee and + invoke the "getAttributes()" method. It should return + a NamedNodeMap containing the attributes of the Element + node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodeelementnodeattributes() { + var success; + if(checkInitialization(builder, "nodeelementnodeattributes") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrNode; + var attrName; + var attrList = new Array(); + + expected = new Array(); + expected[0] = "domestic"; + expected[1] = "street"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(2); + addrAttr = testAddr.attributes; + + for(var indexN65628 = 0;indexN65628 < addrAttr.length; indexN65628++) { + attrNode = addrAttr.item(indexN65628); + attrName = attrNode.nodeName; + + attrList[attrList.length] = attrName; + + } + assertEqualsCollection("nodeElementNodeValueAssert1",expected,attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html new file mode 100644 index 0000000000..6f8aefa612 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodename.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeelementnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeelementnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The string returned by the "getNodeName()" method for an + + Element Node is its tagName. + + + + Retrieve the first Element Node(Root Node) of the + + DOM object and check the string returned by the + + "getNodeName()" method. It should be equal to its + + tagName. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function nodeelementnodename() { + var success; + if(checkInitialization(builder, "nodeelementnodename") != null) return; + var doc; + var elementNode; + var elementName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementNode = doc.documentElement; + + elementName = elementNode.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgNodeName","svg",elementName); + + } + + else { + assertEquals("nodeElementNodeNameAssert1","staff",elementName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html new file mode 100644 index 0000000000..8b4b5f2513 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodetype.html @@ -0,0 +1,127 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeelementnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeelementnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for an Element Node + returns the constant value 1. + + Retrieve the root node and invoke the "getNodeType()" + method. The method should return 1. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodeelementnodetype() { + var success; + if(checkInitialization(builder, "nodeelementnodetype") != null) return; + var doc; + var rootNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + rootNode = doc.documentElement; + + nodeType = rootNode.nodeType; + + assertEquals("nodeElementNodeTypeAssert1",1,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html new file mode 100644 index 0000000000..16a386b9d5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeelementnodevalue.html @@ -0,0 +1,124 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeelementnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeelementnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for an + Element Node is null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodeelementnodevalue() { + var success; + if(checkInitialization(builder, "nodeelementnodevalue") != null) return; + var doc; + var elementNode; + var elementValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementNode = doc.documentElement; + + elementValue = elementNode.nodeValue; + + assertNull("elementNodeValueNull",elementValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeelementnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html new file mode 100644 index 0000000000..67da4862eb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodeattributes.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentitynodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentitynodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method invoked on an Entity + Node returns null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodeentitynodeattributes() { + var success; + if(checkInitialization(builder, "nodeentitynodeattributes") != null) return; + var doc; + var docType; + var entities; + var entityNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entityNode = entities.getNamedItem("ent1"); + assertNotNull("ent1NotNull",entityNode); +attrList = entityNode.attributes; + + assertNull("entityAttributesNull",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html new file mode 100644 index 0000000000..41ca8950a1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodename.html @@ -0,0 +1,131 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentitynodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentitynodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Check the nodeName of the entity returned by DocumentType.entities.getNamedItem("ent1"). + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodeentitynodename() { + var success; + if(checkInitialization(builder, "nodeentitynodename") != null) return; + var doc; + var docType; + var entities; + var entityNode; + var entityName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entityNode = entities.getNamedItem("ent1"); + assertNotNull("entityNodeNotNull",entityNode); +entityName = entityNode.nodeName; + + assertEquals("entityNodeName","ent1",entityName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html new file mode 100644 index 0000000000..14add6004f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodetype.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentitynodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentitynodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for an Entity Node + returns the constant value 6. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodeentitynodetype() { + var success; + if(checkInitialization(builder, "nodeentitynodetype") != null) return; + var doc; + var docType; + var entities; + var entityNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entityNode = entities.getNamedItem("ent1"); + assertNotNull("ent1NotNull",entityNode); +nodeType = entityNode.nodeType; + + assertEquals("entityNodeType",6,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html new file mode 100644 index 0000000000..c72ee54257 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitynodevalue.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentitynodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentitynodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for an + Entity Node is null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodeentitynodevalue() { + var success; + if(checkInitialization(builder, "nodeentitynodevalue") != null) return; + var doc; + var docType; + var entities; + var entityNode; + var entityValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entityNode = entities.getNamedItem("ent1"); + assertNotNull("ent1NotNull",entityNode); +entityValue = entityNode.nodeValue; + + assertNull("entityNodeValue",entityValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitynodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html new file mode 100644 index 0000000000..8f3e45e7cf --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodeattributes.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentityreferencenodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentityreferencenodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method invoked on an EntityReference + Node returns null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodeentityreferencenodeattributes() { + var success; + if(checkInitialization(builder, "nodeentityreferencenodeattributes") != null) return; + var doc; + var elementList; + var entRefAddr; + var entRefNode; + var attrList; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + entRefAddr = elementList.item(1); + entRefNode = entRefAddr.firstChild; + + nodeType = entRefNode.nodeType; + + + if( + !(5 == nodeType) + ) { + entRefNode = doc.createEntityReference("ent2"); + assertNotNull("createdEntRefNotNull",entRefNode); + + } + attrList = entRefNode.attributes; + + assertNull("attrList",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html new file mode 100644 index 0000000000..a1c3318e6f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodename.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentityreferencenodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentityreferencenodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for an + EntityReference Node is the name of the entity referenced. + + Retrieve the first Entity Reference node from the last + child of the second employee and check the string + returned by the "getNodeName()" method. It should be + equal to "ent2". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodeentityreferencenodename() { + var success; + if(checkInitialization(builder, "nodeentityreferencenodename") != null) return; + var doc; + var elementList; + var entRefAddr; + var entRefNode; + var entRefName; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + entRefAddr = elementList.item(1); + entRefNode = entRefAddr.firstChild; + + nodeType = entRefNode.nodeType; + + + if( + !(5 == nodeType) + ) { + entRefNode = doc.createEntityReference("ent2"); + assertNotNull("createdEntRefNotNull",entRefNode); + + } + entRefName = entRefNode.nodeName; + + assertEquals("nodeEntityReferenceNodeNameAssert1","ent2",entRefName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html new file mode 100644 index 0000000000..6d8fccc53f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodetype.html @@ -0,0 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentityreferencenodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentityreferencenodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for an EntityReference Node + returns the constant value 5. + + Retrieve the EntityReference node from the last child + of the second employee and invoke the "getNodeType()" + method. The method should return 5. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodeentityreferencenodetype() { + var success; + if(checkInitialization(builder, "nodeentityreferencenodetype") != null) return; + var doc; + var elementList; + var entRefAddr; + var entRefNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + entRefAddr = elementList.item(1); + entRefNode = entRefAddr.firstChild; + + nodeType = entRefNode.nodeType; + + + if( + (3 == nodeType) + ) { + entRefNode = doc.createEntityReference("ent2"); + assertNotNull("createdEntRefNotNull",entRefNode); +nodeType = entRefNode.nodeType; + + + } + assertEquals("entityNodeType",5,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html new file mode 100644 index 0000000000..47611df024 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentityreferencenodevalue.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentityreferencenodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentityreferencenodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for an + EntityReference Node is null. + + Retrieve the first Entity Reference node from the last + child of the second employee and check the string + returned by the "getNodeValue()" method. It should be + equal to null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodeentityreferencenodevalue() { + var success; + if(checkInitialization(builder, "nodeentityreferencenodevalue") != null) return; + var doc; + var elementList; + var entRefAddr; + var entRefNode; + var entRefValue; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + entRefAddr = elementList.item(1); + entRefNode = entRefAddr.firstChild; + + nodeType = entRefNode.nodeType; + + + if( + (3 == nodeType) + ) { + entRefNode = doc.createEntityReference("ent2"); + assertNotNull("createdEntRefNotNull",entRefNode); + + } + entRefValue = entRefNode.nodeValue; + + assertNull("entRefNodeValue",entRefValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentityreferencenodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html new file mode 100644 index 0000000000..3bbec6d527 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeentitysetnodevalue.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitysetnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeentitysetnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeentitysetnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for an + Entity Node is always null and "setNodeValue" should have no effect. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2 +*/ +function nodeentitysetnodevalue() { + var success; + if(checkInitialization(builder, "nodeentitysetnodevalue") != null) return; + var doc; + var docType; + var entities; + var entityNode; + var entityValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entityNode = entities.getNamedItem("ent1"); + assertNotNull("ent1NotNull",entityNode); +entityNode.nodeValue = "This should have no effect"; + + entityValue = entityNode.nodeValue; + + assertNull("nodeValueNull",entityValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeentitysetnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html new file mode 100644 index 0000000000..dc6468fe59 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchild.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetfirstchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetfirstchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getFirstChild()" method returns the first child + of this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 +*/ +function nodegetfirstchild() { + var success; + if(checkInitialization(builder, "nodegetfirstchild") != null) return; + var doc; + var elementList; + var employeeNode; + var fchildNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + fchildNode = employeeNode.firstChild; + + childName = fchildNode.nodeName; + + + if( + ("#text" == childName) + ) { + fchildNode = fchildNode.nextSibling; + + childName = fchildNode.nodeName; + + + } + assertEquals("nodeName","employeeId",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html new file mode 100644 index 0000000000..e2d6d60309 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetfirstchildnull.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchildnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetfirstchildnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetfirstchildnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a first child then the "getFirstChild()" + + method returns null. + + + + Retrieve the Text node form the second child of the first + + employee and invoke the "getFirstChild()" method. It + + should return null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 +*/ +function nodegetfirstchildnull() { + var success; + if(checkInitialization(builder, "nodegetfirstchildnull") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var secondChildNode; + var textNode; + var noChildNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(0); + employeeList = employeeNode.childNodes; + + secondChildNode = employeeList.item(1); + textNode = secondChildNode.firstChild; + + noChildNode = textNode.firstChild; + + assertNull("nodeGetFirstChildNullAssert1",noChildNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetfirstchildnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html new file mode 100644 index 0000000000..04621db853 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchild.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetlastchild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetlastchild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLastChild()" method returns the last child + of this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB +*/ +function nodegetlastchild() { + var success; + if(checkInitialization(builder, "nodegetlastchild") != null) return; + var doc; + var elementList; + var employeeNode; + var lchildNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + lchildNode = employeeNode.lastChild; + + childName = lchildNode.nodeName; + + + if( + ("#text" == childName) + ) { + lchildNode = lchildNode.previousSibling; + + childName = lchildNode.nodeName; + + + } + assertEquals("nodeName","address",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html new file mode 100644 index 0000000000..2050f769dd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetlastchildnull.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchildnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetlastchildnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetlastchildnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a last child then the "getLastChild()" + + method returns null. + + + + Retrieve the Text node from the second child of the first + + employee and invoke the "getLastChild()" method. It + + should return null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB +*/ +function nodegetlastchildnull() { + var success; + if(checkInitialization(builder, "nodegetlastchildnull") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var secondChildNode; + var textNode; + var noChildNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(0); + employeeList = employeeNode.childNodes; + + secondChildNode = employeeList.item(1); + textNode = secondChildNode.firstChild; + + noChildNode = textNode.lastChild; + + assertNull("nodeGetLastChildNullAssert1",noChildNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetlastchildnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html new file mode 100644 index 0000000000..a174ece9c0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsibling.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsibling</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetnextsibling']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetnextsibling'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNextSibling()" method returns the node immediately + following this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F +*/ +function nodegetnextsibling() { + var success; + if(checkInitialization(builder, "nodegetnextsibling") != null) return; + var doc; + var elementList; + var employeeIdNode; + var nsNode; + var nsName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employeeId"); + employeeIdNode = elementList.item(1); + nsNode = employeeIdNode.nextSibling; + + nsName = nsNode.nodeName; + + + if( + ("#text" == nsName) + ) { + nsNode = nsNode.nextSibling; + + nsName = nsNode.nodeName; + + + } + assertEquals("nodeName","name",nsName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsibling</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html new file mode 100644 index 0000000000..eb243b43f1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetnextsiblingnull.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetnextsiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetnextsiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a node immediately following this node the + + "getNextSibling()" method returns null. + + + + Retrieve the first child of the second employee and + + invoke the "getNextSibling()" method. It should + + be set to null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F +*/ +function nodegetnextsiblingnull() { + var success; + if(checkInitialization(builder, "nodegetnextsiblingnull") != null) return; + var doc; + var elementList; + var employeeNode; + var lcNode; + var nsNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + lcNode = employeeNode.lastChild; + + nsNode = lcNode.nextSibling; + + assertNull("nodeGetNextSiblingNullAssert1",nsNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetnextsiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html new file mode 100644 index 0000000000..4a571e6dc0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocument.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetownerdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetownerdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getOwnerDocument()" method returns the Document + object associated with this node. + + Retrieve the second employee and examine Document + returned by the "getOwnerDocument()" method. Invoke + the "getDocumentElement()" on the Document which will + return an Element that is equal to "staff". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function nodegetownerdocument() { + var success; + if(checkInitialization(builder, "nodegetownerdocument") != null) return; + var doc; + var elementList; + var docNode; + var ownerDocument; + var docElement; + var elementName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + docNode = elementList.item(1); + ownerDocument = docNode.ownerDocument; + + docElement = ownerDocument.documentElement; + + elementName = docElement.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgTagName","svg",elementName); + + } + + else { + assertEquals("nodeGetOwnerDocumentAssert1","staff",elementName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html new file mode 100644 index 0000000000..b53d50c222 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetownerdocumentnull.html @@ -0,0 +1,121 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocumentnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetownerdocumentnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetownerdocumentnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getOwnerDocument()" method returns null if the target + node itself is a document. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc +*/ +function nodegetownerdocumentnull() { + var success; + if(checkInitialization(builder, "nodegetownerdocumentnull") != null) return; + var doc; + var ownerDocument; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + ownerDocument = doc.ownerDocument; + + assertNull("documentOwnerDocumentNull",ownerDocument); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetownerdocumentnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html new file mode 100644 index 0000000000..34189177b4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussibling.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussibling</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetprevioussibling']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetprevioussibling'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getPreviousSibling()" method returns the node + immediately preceding this node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 +*/ +function nodegetprevioussibling() { + var success; + if(checkInitialization(builder, "nodegetprevioussibling") != null) return; + var doc; + var elementList; + var nameNode; + var psNode; + var psName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(1); + psNode = nameNode.previousSibling; + + psName = psNode.nodeName; + + + if( + ("#text" == psName) + ) { + psNode = psNode.previousSibling; + + psName = psNode.nodeName; + + + } + assertEquals("nodeName","employeeId",psName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussibling</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html new file mode 100644 index 0000000000..df81223251 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodegetprevioussiblingnull.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussiblingnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetprevioussiblingnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodegetprevioussiblingnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + If there is not a node immediately preceding this node the + + "getPreviousSibling()" method returns null. + + + + Retrieve the first child of the second employee and + + invoke the "getPreviousSibling()" method. It should + + be set to null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 +*/ +function nodegetprevioussiblingnull() { + var success; + if(checkInitialization(builder, "nodegetprevioussiblingnull") != null) return; + var doc; + var elementList; + var employeeNode; + var fcNode; + var psNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + fcNode = employeeNode.firstChild; + + psNode = fcNode.previousSibling; + + assertNull("nodeGetPreviousSiblingNullAssert1",psNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodegetprevioussiblingnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html new file mode 100644 index 0000000000..546c381fa1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodes.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodehaschildnodes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodehaschildnodes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "hasChildNodes()" method returns true if the node + has children. + + Retrieve the root node("staff") and invoke the + "hasChildNodes()" method. It should return the boolean + value "true". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 +*/ +function nodehaschildnodes() { + var success; + if(checkInitialization(builder, "nodehaschildnodes") != null) return; + var doc; + var elementList; + var employeeNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + state = employeeNode.hasChildNodes(); + assertTrue("nodeHasChildAssert1",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html new file mode 100644 index 0000000000..d597fb104a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodehaschildnodesfalse.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodesfalse</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodehaschildnodesfalse']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodehaschildnodesfalse'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "hasChildNodes()" method returns false if the node + does not have any children. + + Retrieve the Text node inside the first child of the + second employee and invoke the "hasChildNodes()" method. + It should return the boolean value "false". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 +*/ +function nodehaschildnodesfalse() { + var success; + if(checkInitialization(builder, "nodehaschildnodesfalse") != null) return; + var doc; + var elementList; + var child; + var employeeIdList; + var employeeNode; + var textNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + child = elementList.item(1); + employeeIdList = child.childNodes; + + employeeNode = employeeIdList.item(1); + textNode = employeeNode.firstChild; + + state = textNode.hasChildNodes(); + assertFalse("nodeHasChildFalseAssert1",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodehaschildnodesfalse</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html new file mode 100644 index 0000000000..f46e30ee9c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbefore.html @@ -0,0 +1,189 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbefore</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbefore']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbefore'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method inserts the + node "newChild" before the node "refChild". + + Insert a newly created Element node before the eigth + child of the second employee and check the "newChild" + and "refChild" after insertion for correct placement. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbefore() { + var success; + if(checkInitialization(builder, "nodeinsertbefore") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newChild; + var child; + var childName; + var length; + var insertedNode; + var actual = new Array(); + + expectedWithWhitespace = new Array(); + expectedWithWhitespace[0] = "#text"; + expectedWithWhitespace[1] = "employeeId"; + expectedWithWhitespace[2] = "#text"; + expectedWithWhitespace[3] = "name"; + expectedWithWhitespace[4] = "#text"; + expectedWithWhitespace[5] = "position"; + expectedWithWhitespace[6] = "#text"; + expectedWithWhitespace[7] = "newChild"; + expectedWithWhitespace[8] = "salary"; + expectedWithWhitespace[9] = "#text"; + expectedWithWhitespace[10] = "gender"; + expectedWithWhitespace[11] = "#text"; + expectedWithWhitespace[12] = "address"; + expectedWithWhitespace[13] = "#text"; + + expectedWithoutWhitespace = new Array(); + expectedWithoutWhitespace[0] = "employeeId"; + expectedWithoutWhitespace[1] = "name"; + expectedWithoutWhitespace[2] = "position"; + expectedWithoutWhitespace[3] = "newChild"; + expectedWithoutWhitespace[4] = "salary"; + expectedWithoutWhitespace[5] = "gender"; + expectedWithoutWhitespace[6] = "address"; + + var expected = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + length = childList.length; + + + if( + (6 == length) + ) { + refChild = childList.item(3); + expected = expectedWithoutWhitespace; + + } + + else { + refChild = childList.item(7); + expected = expectedWithWhitespace; + + } + newChild = doc.createElement("newChild"); + insertedNode = employeeNode.insertBefore(newChild,refChild); + for(var indexN65756 = 0;indexN65756 < childList.length; indexN65756++) { + child = childList.item(indexN65756); + childName = child.nodeName; + + actual[actual.length] = childName; + + } + assertEqualsList("nodeNames",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbefore</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html new file mode 100644 index 0000000000..83fc318948 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforedocfragment.html @@ -0,0 +1,155 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforedocfragment</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforedocfragment']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforedocfragment'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is a DocumentFragment object then all + its children are inserted in the same order before the + the "refChild". + + Create a DocumentFragment object and populate it with + two Element nodes. Retrieve the second employee and + insert the newly created DocumentFragment before its + fourth child. The second employee should now have two + extra children("newChild1" and "newChild2") at + positions fourth and fifth respectively. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbeforedocfragment() { + var success; + if(checkInitialization(builder, "nodeinsertbeforedocfragment") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newdocFragment; + var newChild1; + var newChild2; + var child; + var childName; + var appendedChild; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + refChild = childList.item(3); + newdocFragment = doc.createDocumentFragment(); + newChild1 = doc.createElement("newChild1"); + newChild2 = doc.createElement("newChild2"); + appendedChild = newdocFragment.appendChild(newChild1); + appendedChild = newdocFragment.appendChild(newChild2); + insertedNode = employeeNode.insertBefore(newdocFragment,refChild); + child = childList.item(3); + childName = child.nodeName; + + assertEquals("childName3","newChild1",childName); + child = childList.item(4); + childName = child.nodeName; + + assertEquals("childName4","newChild2",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforedocfragment</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html new file mode 100644 index 0000000000..b43ceabeb0 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforeinvalidnodetype.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforeinvalidnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforeinvalidnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforeinvalidnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if this node is of + a type that does not allow children of the type "newChild" + to be inserted. + + Retrieve the root node and attempt to insert a newly + created Attr node. An Element node cannot have children + of the "Attr" type, therefore the desired exception + should be raised. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodeinsertbeforeinvalidnodetype() { + var success; + if(checkInitialization(builder, "nodeinsertbeforeinvalidnodetype") != null) return; + var doc; + var rootNode; + var newChild; + var elementList; + var refChild; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + rootNode = doc.documentElement; + + newChild = doc.createAttribute("newAttribute"); + elementList = doc.getElementsByTagName("employee"); + refChild = elementList.item(1); + + { + success = false; + try { + insertedNode = rootNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforeinvalidnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html new file mode 100644 index 0000000000..5c55425f90 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchilddiffdocument.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchilddiffdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforenewchilddiffdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforenewchilddiffdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + WRONG_DOCUMENT_ERR DOMException if the "newChild" was + created from a different document than the one that + created this node. + + Retrieve the second employee and attempt to insert a new + child that was created from a different document than the + one that created the second employee. An attempt to + insert such a child should raise the desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbeforenewchilddiffdocument() { + var success; + if(checkInitialization(builder, "nodeinsertbeforenewchilddiffdocument") != null) return; + var doc1; + var doc2; + var refChild; + var newChild; + var elementList; + var elementNode; + var insertedNode; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "staff"); + newChild = doc1.createElement("newChild"); + elementList = doc2.getElementsByTagName("employee"); + elementNode = elementList.item(1); + refChild = elementNode.firstChild; + + + { + success = false; + try { + insertedNode = elementNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchilddiffdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html new file mode 100644 index 0000000000..c60cd8a9d7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenewchildexists.html @@ -0,0 +1,191 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchildexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforenewchildexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforenewchildexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "newChild" is already in the tree, the + "insertBefore(newChild,refChild)" method must first + remove it before the insertion takes place. + + Insert a node Element ("employeeId") that is already + present in the tree. The existing node should be + removed first and the new one inserted. The node is + inserted at a different position in the tree to assure + that it was indeed inserted. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbeforenewchildexists() { + var success; + if(checkInitialization(builder, "nodeinsertbeforenewchildexists") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newChild; + var child; + var length; + var childName; + var insertedNode; + expectedWhitespace = new Array(); + expectedWhitespace[0] = "#text"; + expectedWhitespace[1] = "#text"; + expectedWhitespace[2] = "name"; + expectedWhitespace[3] = "#text"; + expectedWhitespace[4] = "position"; + expectedWhitespace[5] = "#text"; + expectedWhitespace[6] = "salary"; + expectedWhitespace[7] = "#text"; + expectedWhitespace[8] = "gender"; + expectedWhitespace[9] = "#text"; + expectedWhitespace[10] = "employeeId"; + expectedWhitespace[11] = "address"; + expectedWhitespace[12] = "#text"; + + expectedNoWhitespace = new Array(); + expectedNoWhitespace[0] = "name"; + expectedNoWhitespace[1] = "position"; + expectedNoWhitespace[2] = "salary"; + expectedNoWhitespace[3] = "gender"; + expectedNoWhitespace[4] = "employeeId"; + expectedNoWhitespace[5] = "address"; + + var expected = new Array(); + + var result = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + length = childList.length; + + + if( + (6 == length) + ) { + expected = expectedNoWhitespace; +refChild = childList.item(5); + newChild = childList.item(0); + + } + + else { + expected = expectedWhitespace; +refChild = childList.item(11); + newChild = childList.item(1); + + } + insertedNode = employeeNode.insertBefore(newChild,refChild); + for(var indexN65757 = 0;indexN65757 < childList.length; indexN65757++) { + child = childList.item(indexN65757); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsList("childNames",expected,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchildexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html new file mode 100644 index 0000000000..35be8ffb61 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodeancestor.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodeancestor</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforenodeancestor']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforenodeancestor'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if the node to be + inserted is one of this nodes ancestors. + + Retrieve the second employee and attempt to insert a + node that is one of its ancestors(root node). An + attempt to insert such a node should raise the + desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodeinsertbeforenodeancestor() { + var success; + if(checkInitialization(builder, "nodeinsertbeforenodeancestor") != null) return; + var doc; + var newChild; + var elementList; + var employeeNode; + var childList; + var refChild; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newChild = doc.documentElement; + + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + refChild = childList.item(0); + + { + success = false; + try { + insertedNode = employeeNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodeancestor</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html new file mode 100644 index 0000000000..3ba6abae44 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenodename.html @@ -0,0 +1,140 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforenodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforenodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refchild)" method returns + the node being inserted. + + Insert an Element node before the fourth + child of the second employee and check the node + returned from the "insertBefore(newChild,refChild)" + method. The node returned should be "newChild". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbeforenodename() { + var success; + if(checkInitialization(builder, "nodeinsertbeforenodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild; + var newChild; + var insertedNode; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + refChild = childList.item(3); + newChild = doc.createElement("newChild"); + insertedNode = employeeNode.insertBefore(newChild,refChild); + childName = insertedNode.nodeName; + + assertEquals("nodeInsertBeforeNodeNameAssert1","newChild",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html new file mode 100644 index 0000000000..8d093a0030 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederr.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "insertBefore(newChild,refChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbeforenomodificationallowederr() { + var success; + if(checkInitialization(builder, "nodeinsertbeforenomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entRef; + var entElement; + var createdNode; + var insertedNode; + var refChild = null; + + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entRef = genderNode.firstChild; + + assertNotNull("entRefNotNull",entRef); +nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +createdNode = doc.createElement("text3"); + + { + success = false; + try { + insertedNode = entElement.insertBefore(createdNode,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NOT_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html new file mode 100644 index 0000000000..1de48d0458 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforenomodificationallowederrEE.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an ent4 entity reference and and execute the "insertBefore(newChild,refChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederr.xml +*/ +function nodeinsertbeforenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "nodeinsertbeforenomodificationallowederrEE") != null) return; + var doc; + var entRef; + var createdNode; + var insertedNode; + var refChild = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +createdNode = doc.createElement("text3"); + + { + success = false; + try { + insertedNode = entRef.insertBefore(createdNode,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html new file mode 100644 index 0000000000..db86ba3ed7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnonexistent.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnonexistent</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforerefchildnonexistent']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforerefchildnonexistent'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "insertBefore(newChild,refChild)" method raises a + NOT_FOUND_ERR DOMException if the reference child is + not a child of this node. + + Retrieve the second employee and attempt to insert a + new node before a reference node that is not a child + of this node. An attempt to insert before a non child + node should raise the desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodeinsertbeforerefchildnonexistent() { + var success; + if(checkInitialization(builder, "nodeinsertbeforerefchildnonexistent") != null) return; + var doc; + var refChild; + var newChild; + var elementList; + var elementNode; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newChild = doc.createElement("newChild"); + refChild = doc.createElement("refChild"); + elementList = doc.getElementsByTagName("employee"); + elementNode = elementList.item(1); + + { + success = false; + try { + insertedNode = elementNode.insertBefore(newChild,refChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnonexistent</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html new file mode 100644 index 0000000000..005df52fcb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeinsertbeforerefchildnull.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeinsertbeforerefchildnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeinsertbeforerefchildnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If the "refChild" is null then the + "insertBefore(newChild,refChild)" method inserts the + node "newChild" at the end of the list of children. + + Retrieve the second employee and invoke the + "insertBefore(newChild,refChild)" method with + refChild=null. Since "refChild" is null the "newChild" + should be added to the end of the list. The last item + in the list is checked after insertion. The last Element + node of the list should be "newChild". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 +*/ +function nodeinsertbeforerefchildnull() { + var success; + if(checkInitialization(builder, "nodeinsertbeforerefchildnull") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var refChild = null; + + var newChild; + var child; + var childName; + var insertedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + newChild = doc.createElement("newChild"); + insertedNode = employeeNode.insertBefore(newChild,refChild); + child = employeeNode.lastChild; + + childName = child.nodeName; + + assertEquals("nodeInsertBeforeRefChildNullAssert1","newChild",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforerefchildnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html new file mode 100644 index 0000000000..d3e846ac50 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexequalzero.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexequalzero</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelistindexequalzero']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelistindexequalzero'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a list of all the children elements of the third + employee and access its first child by using an index + of 0. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +*/ +function nodelistindexequalzero() { + var success; + if(checkInitialization(builder, "nodelistindexequalzero") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + child = employeeList.item(0); + childName = child.nodeName; + + + if( + !("#text" == childName) + ) { + assertEquals("childName","employeeId",childName); + + } + else { + // Ensure at least one SimpleTest check is reported. (Bug 483992) + todo_isnot(childName, "#text", "Fake default check"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexequalzero</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html new file mode 100644 index 0000000000..0facd2d795 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlength.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlength</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelistindexgetlength']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelistindexgetlength'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of nodes + in the list should be 6 (no whitespace) or 13. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 +*/ +function nodelistindexgetlength() { + var success; + if(checkInitialization(builder, "nodelistindexgetlength") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var length; + var expectedCount = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + length = employeeList.length; + + assertTrue("lengthIs6or13", + + ((6 == length) || (13 == length)) +); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlength</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html new file mode 100644 index 0000000000..8eaa7f002c --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexgetlengthofemptylist.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlengthofemptylist</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelistindexgetlengthofemptylist']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelistindexgetlengthofemptylist'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getLength()" method returns the number of nodes + in the list.(Test for EMPTY list) + + Create a list of all the children of the Text node + inside the first child of the third employee and + invoke the "getLength()" method. It should contain + the value 0. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 +*/ +function nodelistindexgetlengthofemptylist() { + var success; + if(checkInitialization(builder, "nodelistindexgetlengthofemptylist") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var childNode; + var textNode; + var textList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + childNode = employeeList.item(1); + textNode = childNode.firstChild; + + textList = textNode.childNodes; + + assertSize("nodelistIndexGetLengthOfEmptyListAssert",0,textList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexgetlengthofemptylist</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html b/dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html new file mode 100644 index 0000000000..22c3a8edbd --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelistindexnotzero.html @@ -0,0 +1,148 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexnotzero</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelistindexnotzero']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelistindexnotzero'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create a list of all the children elements of the third + employee and access its fourth child by using an index + of 3. This should result in "name" being + selected. Further we evaluate its content(by using + the "getNodeName()" method) to ensure the proper + element was accessed. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +*/ +function nodelistindexnotzero() { + var success; + if(checkInitialization(builder, "nodelistindexnotzero") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var length; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + length = employeeList.length; + + + if( + (6 == length) + ) { + child = employeeList.item(1); + + } + + else { + child = employeeList.item(3); + + } + childName = child.nodeName; + + assertEquals("nodeName","name",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexnotzero</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html new file mode 100644 index 0000000000..a1ba7597d6 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnfirstitem.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnfirstitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelistreturnfirstitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelistreturnfirstitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Get the first child of the third employee using NodeList.item(0) +which will either be a Text node (whitespace) or employeeId element. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +*/ +function nodelistreturnfirstitem() { + var success; + if(checkInitialization(builder, "nodelistreturnfirstitem") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + child = employeeList.item(0); + childName = child.nodeName; + + length = employeeList.length; + + + if( + (6 == length) + ) { + assertEquals("firstChildNoWhitespace","employeeId".toLowerCase(),childName.toLowerCase()); + + } + + else { + assertEquals("firstChildWithWhitespace","#text".toLowerCase(),childName.toLowerCase()); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnfirstitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html new file mode 100644 index 0000000000..23eb82968b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelistreturnlastitem.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnlastitem</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelistreturnlastitem']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelistreturnlastitem'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +Get this last child of the third employee using NodeList.item(NodeList.length - 1) +and check that it is either a Text element (with whitespace) or an address element. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +*/ +function nodelistreturnlastitem() { + var success; + if(checkInitialization(builder, "nodelistreturnlastitem") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + length = employeeList.length; + + + if( + (6 == length) + ) { + child = employeeList.item(5); + childName = child.nodeName; + + assertEquals("nodeName1","address",childName); + + } + + else { + child = employeeList.item(12); + childName = child.nodeName; + + assertEquals("nodeName2","#text",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnlastitem</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html b/dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html new file mode 100644 index 0000000000..47807794bb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodelisttraverselist.html @@ -0,0 +1,177 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelisttraverselist</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodelisttraverselist']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodelisttraverselist'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The range of valid child node indices is 0 thru length -1 + + Create a list of all the children elements of the third + employee and traverse the list from index=0 thru + length -1. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 +*/ +function nodelisttraverselist() { + var success; + if(checkInitialization(builder, "nodelisttraverselist") != null) return; + var doc; + var elementList; + var employeeNode; + var employeeList; + var child; + var childName; + var result = new Array(); + + var length; + expectedWhitespace = new Array(); + expectedWhitespace[0] = "#text"; + expectedWhitespace[1] = "employeeId"; + expectedWhitespace[2] = "#text"; + expectedWhitespace[3] = "name"; + expectedWhitespace[4] = "#text"; + expectedWhitespace[5] = "position"; + expectedWhitespace[6] = "#text"; + expectedWhitespace[7] = "salary"; + expectedWhitespace[8] = "#text"; + expectedWhitespace[9] = "gender"; + expectedWhitespace[10] = "#text"; + expectedWhitespace[11] = "address"; + expectedWhitespace[12] = "#text"; + + expectedNoWhitespace = new Array(); + expectedNoWhitespace[0] = "employeeId"; + expectedNoWhitespace[1] = "name"; + expectedNoWhitespace[2] = "position"; + expectedNoWhitespace[3] = "salary"; + expectedNoWhitespace[4] = "gender"; + expectedNoWhitespace[5] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(2); + employeeList = employeeNode.childNodes; + + length = employeeList.length; + + for(var indexN65700 = 0;indexN65700 < employeeList.length; indexN65700++) { + child = employeeList.item(indexN65700); + childName = child.nodeName; + + result[result.length] = childName; + + } + + if( + (6 == length) + ) { + assertEqualsList("nowhitespace",expectedNoWhitespace,result); + + } + + else { + assertEqualsList("whitespace",expectedWhitespace,result); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelisttraverselist</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html new file mode 100644 index 0000000000..143ce069c8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodeattributes.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodenotationnodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodenotationnodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getAttributes()" method invoked on a Notation + Node returns null. + + Retrieve the Notation declaration inside the DocumentType + node and invoke the "getAttributes()" method on the + Notation Node. It should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodenotationnodeattributes() { + var success; + if(checkInitialization(builder, "nodenotationnodeattributes") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + assertNotNull("notationNotNull",notationNode); +attrList = notationNode.attributes; + + assertNull("nodeNotationNodeAttributesAssert1",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html new file mode 100644 index 0000000000..0fa526fbe7 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodename.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodenotationnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodenotationnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeName()" method for a + Notation Node is the name of the notation. + + Retrieve the Notation declaration inside the + DocumentType node and check the string returned + by the "getNodeName()" method. It should be equal to + "notation1". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodenotationnodename() { + var success; + if(checkInitialization(builder, "nodenotationnodename") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var notationName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + assertNotNull("notationNotNull",notationNode); +notationName = notationNode.nodeName; + + assertEquals("nodeName","notation1",notationName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html new file mode 100644 index 0000000000..479aa6b68d --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodetype.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodenotationnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodenotationnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getNodeType()" method for an Notation Node + returns the constant value 12. + + Retrieve the Notation declaration in the DocumentType + node and invoke the "getNodeType()" method. The method + should return 12. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodenotationnodetype() { + var success; + if(checkInitialization(builder, "nodenotationnodetype") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + assertNotNull("notationNotNull",notationNode); +nodeType = notationNode.nodeType; + + assertEquals("nodeNotationNodeTypeAssert1",12,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html new file mode 100644 index 0000000000..72d1ec45d1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodenotationnodevalue.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodenotationnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodenotationnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Notation Node is null. + + Retrieve the Notation declaration inside the + DocumentType node and check the string returned + by the "getNodeValue()" method. It should be equal to + null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodenotationnodevalue() { + var success; + if(checkInitialization(builder, "nodenotationnodevalue") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var notationValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + assertNotNull("notationNotNull",notationNode); +notationValue = notationNode.nodeValue; + + assertNull("nodeValue",notationValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodenotationnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html b/dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html new file mode 100644 index 0000000000..917e3e01d3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeparentnode.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeparentnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeparentnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getParentNode()" method returns the parent + of this node. + + Retrieve the second employee and invoke the + "getParentNode()" method on this node. It should + be set to "staff". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 +*/ +function nodeparentnode() { + var success; + if(checkInitialization(builder, "nodeparentnode") != null) return; + var doc; + var elementList; + var employeeNode; + var parentNode; + var parentName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + parentNode = employeeNode.parentNode; + + parentName = parentNode.nodeName; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertEquals("svgTagName","svg",parentName); + + } + + else { + assertEquals("nodeParentNodeAssert1","staff",parentName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html b/dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html new file mode 100644 index 0000000000..14efc6f7aa --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeparentnodenull.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnodenull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeparentnodenull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeparentnodenull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getParentNode()" method invoked on a node that has + just been created and not yet added to the tree is null. + + Create a new "employee" Element node using the + "createElement(name)" method from the Document interface. + Since this new node has not yet been added to the tree, + the "getParentNode()" method will return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 +*/ +function nodeparentnodenull() { + var success; + if(checkInitialization(builder, "nodeparentnodenull") != null) return; + var doc; + var createdNode; + var parentNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + createdNode = doc.createElement("employee"); + parentNode = createdNode.parentNode; + + assertNull("parentNode",parentNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeparentnodenull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html new file mode 100644 index 0000000000..01073acdbb --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodeattributes.html @@ -0,0 +1,135 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodeattributes</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeprocessinginstructionnodeattributes']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeprocessinginstructionnodeattributes'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getAttributes()" method invoked on a Processing + + Instruction Node returns null. + + + + Retrieve the Processing Instruction node and invoke + + the "getAttributes()" method. It should return null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +*/ +function nodeprocessinginstructionnodeattributes() { + var success; + if(checkInitialization(builder, "nodeprocessinginstructionnodeattributes") != null) return; + var doc; + var testList; + var piNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + testList = doc.childNodes; + + piNode = testList.item(0); + attrList = piNode.attributes; + + assertNull("nodeProcessingInstructionNodeAttrAssert1",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodeattributes</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html new file mode 100644 index 0000000000..5bf485882e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodename.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeprocessinginstructionnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeprocessinginstructionnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The string returned by the "getNodeName()" method for a + + Processing Instruction Node is the target. + + + + Retrieve the Processing Instruction Node in the XML file + + and check the string returned by the "getNodeName()" + + method. It should be equal to "XML-STYLE". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodeprocessinginstructionnodename() { + var success; + if(checkInitialization(builder, "nodeprocessinginstructionnodename") != null) return; + var doc; + var testList; + var piNode; + var piName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + testList = doc.childNodes; + + piNode = testList.item(0); + piName = piNode.nodeName; + + assertEquals("nodeProcessingInstructionNodeNameAssert1","TEST-STYLE",piName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html new file mode 100644 index 0000000000..f619b86d3f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodetype.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeprocessinginstructionnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeprocessinginstructionnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getNodeType()" method for a Processing Instruction + + node returns the constant value 7. + + + + Retrieve a NodeList of child elements from the document. + + Retrieve the first child and invoke the "getNodeType()" + + method. The method should return 7. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodeprocessinginstructionnodetype() { + var success; + if(checkInitialization(builder, "nodeprocessinginstructionnodetype") != null) return; + var doc; + var testList; + var piNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + testList = doc.childNodes; + + piNode = testList.item(0); + nodeType = piNode.nodeType; + + assertEquals("nodeProcessingInstructionNodeTypeAssert1",7,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html new file mode 100644 index 0000000000..8e8e617d13 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionnodevalue.html @@ -0,0 +1,131 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeprocessinginstructionnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeprocessinginstructionnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Processing Instruction Node is the content of the + Processing Instruction(exclude the target). + + Retrieve the Processing Instruction node in the XML file + and check the string returned by the "getNodeValue()" + method. It should be equal to "PIDATA". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodeprocessinginstructionnodevalue() { + var success; + if(checkInitialization(builder, "nodeprocessinginstructionnodevalue") != null) return; + var doc; + var testList; + var piNode; + var piValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + testList = doc.childNodes; + + piNode = testList.item(0); + piValue = piNode.nodeValue; + + assertEquals("value","PIDATA",piValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html new file mode 100644 index 0000000000..7e397046d8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodeprocessinginstructionsetnodevalue.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionsetnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodeprocessinginstructionsetnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodeprocessinginstructionsetnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Setting the nodeValue should change the value returned by + nodeValue and ProcessingInstruction.getData. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1004215813 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=181 +*/ +function nodeprocessinginstructionsetnodevalue() { + var success; + if(checkInitialization(builder, "nodeprocessinginstructionsetnodevalue") != null) return; + var doc; + var testList; + var piNode; + var piValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + testList = doc.childNodes; + + piNode = testList.item(0); + piNode.nodeValue = "Something different"; + + piValue = piNode.nodeValue; + + assertEquals("nodeValue","Something different",piValue); + piValue = piNode.data; + + assertEquals("data","Something different",piValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeprocessinginstructionsetnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechild.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechild.html new file mode 100644 index 0000000000..82a5e242ed --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechild.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['noderemovechild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'noderemovechild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method removes the child node + indicated by "oldChild" from the list of children and + returns it. + + Remove the first employee by invoking the + "removeChild(oldChild)" method an checking the + node returned by the "getParentNode()" method. It + should be set to null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +*/ +function noderemovechild() { + var success; + if(checkInitialization(builder, "noderemovechild") != null) return; + var doc; + var rootNode; + var childList; + var childToRemove; + var removedChild; + var parentNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + rootNode = doc.documentElement; + + childList = rootNode.childNodes; + + childToRemove = childList.item(1); + removedChild = rootNode.removeChild(childToRemove); + parentNode = removedChild.parentNode; + + assertNull("nodeRemoveChildAssert1",parentNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html new file mode 100644 index 0000000000..7ba6577bb4 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildgetnodename.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildgetnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['noderemovechildgetnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'noderemovechildgetnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Remove the first child of the second employee + and check the NodeName returned by the + "removeChild(oldChild)" method. The returned node + should have a NodeName equal to "#text" or employeeId depending on whitespace. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +*/ +function noderemovechildgetnodename() { + var success; + if(checkInitialization(builder, "noderemovechildgetnodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var removedChild; + var childName; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + length = childList.length; + + oldChild = childList.item(0); + removedChild = employeeNode.removeChild(oldChild); + childName = removedChild.nodeName; + + + if( + (6 == length) + ) { + assertEquals("nowhitespace","employeeId",childName); + + } + + else { + assertEquals("whitespace","#text",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildgetnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html new file mode 100644 index 0000000000..d7d88d0c9a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnode.html @@ -0,0 +1,156 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnode</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['noderemovechildnode']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'noderemovechildnode'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second employee and remove its first child. + After the removal, the second employee should have five or twelve + children and the first child should now be the child + that used to be at the second position in the list. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +*/ +function noderemovechildnode() { + var success; + if(checkInitialization(builder, "noderemovechildnode") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var child; + var childName; + var length; + var removedChild; + var removedName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + oldChild = childList.item(0); + removedChild = employeeNode.removeChild(oldChild); + removedName = removedChild.nodeName; + + child = childList.item(0); + childName = child.nodeName; + + length = childList.length; + + + if( + (5 == length) + ) { + assertEquals("removedNameNoWhitespace","employeeId",removedName); + assertEquals("childNameNoWhitespace","name",childName); + + } + + else { + assertEquals("removedName","#text",removedName); + assertEquals("childName","employeeId",childName); + assertEquals("length",12,length); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnode</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html new file mode 100644 index 0000000000..232b22d4a8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederr.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['noderemovechildnomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'noderemovechildnomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "removeChild(oldChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +*/ +function noderemovechildnomodificationallowederr() { + var success; + if(checkInitialization(builder, "noderemovechildnomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entRef; + var entElement; + var removedNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entRef = genderNode.firstChild; + + assertNotNull("entRefNotNull",entRef); +nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); + + { + success = false; + try { + removedNode = entRef.removeChild(entElement); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html new file mode 100644 index 0000000000..6c53a6e688 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildnomodificationallowederrEE.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['noderemovechildnomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'noderemovechildnomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an entity reference and execute the "removeChild(oldChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederr.xml +*/ +function noderemovechildnomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "noderemovechildnomodificationallowederrEE") != null) return; + var doc; + var entRef; + var entText; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +entText = entRef.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + removedNode = entRef.removeChild(entText); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildnomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html new file mode 100644 index 0000000000..7d465ff95f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_noderemovechildoldchildnonexistent.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildoldchildnonexistent</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['noderemovechildoldchildnonexistent']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'noderemovechildoldchildnonexistent'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "removeChild(oldChild)" method raises a + NOT_FOUND_ERR DOMException if the old child is + not a child of this node. + + Retrieve the second employee and attempt to remove a + node that is not one of its children. An attempt to + remove such a node should raise the desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function noderemovechildoldchildnonexistent() { + var success; + if(checkInitialization(builder, "noderemovechildoldchildnonexistent") != null) return; + var doc; + var oldChild; + var elementList; + var elementNode; + var removedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + oldChild = doc.createElement("oldChild"); + elementList = doc.getElementsByTagName("employee"); + elementNode = elementList.item(1); + + { + success = false; + try { + removedChild = elementNode.removeChild(oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/noderemovechildoldchildnonexistent</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html new file mode 100644 index 0000000000..6608a3cfc5 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechild.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechild</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechild']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechild'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method replaces + the node "oldChild" with the node "newChild". + + Replace the first element of the second employee with + a newly created Element node. Check the first position + after the replacement operation is completed. The new + Element should be "newChild". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function nodereplacechild() { + var success; + if(checkInitialization(builder, "nodereplacechild") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var newChild; + var child; + var childName; + var replacedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + oldChild = childList.item(0); + newChild = doc.createElement("newChild"); + replacedNode = employeeNode.replaceChild(newChild,oldChild); + child = childList.item(0); + childName = child.nodeName; + + assertEquals("nodeReplaceChildAssert1","newChild",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechild</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html new file mode 100644 index 0000000000..649d6824df --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildinvalidnodetype.html @@ -0,0 +1,149 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildinvalidnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildinvalidnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildinvalidnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if this node is of + a type that does not allow children of the type "newChild" + to be inserted. + + Retrieve the root node and attempt to replace + one of its children with a newly created Attr node. + An Element node cannot have children of the "Attr" + type, therefore the desired exception should be raised. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodereplacechildinvalidnodetype() { + var success; + if(checkInitialization(builder, "nodereplacechildinvalidnodetype") != null) return; + var doc; + var rootNode; + var newChild; + var elementList; + var oldChild; + var replacedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + rootNode = doc.documentElement; + + newChild = doc.createAttribute("newAttribute"); + elementList = doc.getElementsByTagName("employee"); + oldChild = elementList.item(1); + + { + success = false; + try { + replacedChild = rootNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildinvalidnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html new file mode 100644 index 0000000000..1c601023be --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchilddiffdocument.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchilddiffdocument</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildnewchilddiffdocument']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + docsLoaded += preload(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "staff"); + + if (docsLoaded == 2) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 2) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildnewchilddiffdocument'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + WRONG_DOCUMENT_ERR DOMException if the "newChild" was + created from a different document than the one that + created this node. + + Retrieve the second employee and attempt to replace one + of its children with a node created from a different + document. An attempt to make such a replacement + should raise the desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function nodereplacechildnewchilddiffdocument() { + var success; + if(checkInitialization(builder, "nodereplacechildnewchilddiffdocument") != null) return; + var doc1; + var doc2; + var oldChild; + var newChild; + var elementList; + var elementNode; + var replacedChild; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "staff"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "staff"); + newChild = doc1.createElement("newChild"); + elementList = doc2.getElementsByTagName("employee"); + elementNode = elementList.item(1); + oldChild = elementNode.firstChild; + + + { + success = false; + try { + replacedChild = elementNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + assertTrue("throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchilddiffdocument</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html new file mode 100644 index 0000000000..52c2869c9a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnewchildexists.html @@ -0,0 +1,188 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchildexists</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildnewchildexists']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildnewchildexists'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the second employee and replace its TWELFTH + child(address) with its SECOND child(employeeId). After the + replacement the second child should now be the one that used + to be at the third position and the TWELFTH child should be the + one that used to be at the SECOND position. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function nodereplacechildnewchildexists() { + var success; + if(checkInitialization(builder, "nodereplacechildnewchildexists") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild = null; + + var newChild = null; + + var childName; + var childNode; + var length; + var actual = new Array(); + + var expected = new Array(); + + expectedWithoutWhitespace = new Array(); + expectedWithoutWhitespace[0] = "name"; + expectedWithoutWhitespace[1] = "position"; + expectedWithoutWhitespace[2] = "salary"; + expectedWithoutWhitespace[3] = "gender"; + expectedWithoutWhitespace[4] = "employeeId"; + + expectedWithWhitespace = new Array(); + expectedWithWhitespace[0] = "#text"; + expectedWithWhitespace[1] = "#text"; + expectedWithWhitespace[2] = "name"; + expectedWithWhitespace[3] = "#text"; + expectedWithWhitespace[4] = "position"; + expectedWithWhitespace[5] = "#text"; + expectedWithWhitespace[6] = "salary"; + expectedWithWhitespace[7] = "#text"; + expectedWithWhitespace[8] = "gender"; + expectedWithWhitespace[9] = "#text"; + expectedWithWhitespace[10] = "employeeId"; + expectedWithWhitespace[11] = "#text"; + + var replacedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + length = childList.length; + + + if( + (13 == length) + ) { + newChild = childList.item(1); + oldChild = childList.item(11); + expected = expectedWithWhitespace; + + } + + else { + newChild = childList.item(0); + oldChild = childList.item(5); + expected = expectedWithoutWhitespace; + + } + replacedChild = employeeNode.replaceChild(newChild,oldChild); + assertSame("return_value_same",oldChild,replacedChild); +for(var indexN65758 = 0;indexN65758 < childList.length; indexN65758++) { + childNode = childList.item(indexN65758); + childName = childNode.nodeName; + + actual[actual.length] = childName; + + } + assertEqualsList("childNames",expected,actual); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchildexists</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html new file mode 100644 index 0000000000..57326b4666 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodeancestor.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodeancestor</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildnodeancestor']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildnodeancestor'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + HIERARCHY_REQUEST_ERR DOMException if the node to put + in is one of this node's ancestors. + + Retrieve the second employee and attempt to replace + one of its children with an ancestor node(root node). + An attempt to make such a replacement should raise the + desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodereplacechildnodeancestor() { + var success; + if(checkInitialization(builder, "nodereplacechildnodeancestor") != null) return; + var doc; + var newChild; + var elementList; + var employeeNode; + var childList; + var oldChild; + var replacedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newChild = doc.documentElement; + + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + oldChild = childList.item(0); + + { + success = false; + try { + replacedNode = employeeNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 3); + } + assertTrue("throw_HIERARCHY_REQUEST_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodeancestor</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html new file mode 100644 index 0000000000..2040696479 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnodename.html @@ -0,0 +1,152 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Replace the second Element of the second employee with + a newly created node Element and check the NodeName + returned by the "replaceChild(newChild,oldChild)" + method. The returned node should have a NodeName equal + to "employeeId". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function nodereplacechildnodename() { + var success; + if(checkInitialization(builder, "nodereplacechildnodename") != null) return; + var doc; + var elementList; + var employeeNode; + var childList; + var oldChild; + var newChild; + var replacedNode; + var length; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + childList = employeeNode.childNodes; + + length = childList.length; + + oldChild = childList.item(1); + newChild = doc.createElement("newChild"); + replacedNode = employeeNode.replaceChild(newChild,oldChild); + childName = replacedNode.nodeName; + + + if( + (6 == length) + ) { + assertEquals("nowhitespace","name",childName); + + } + + else { + assertEquals("whitespace","employeeId",childName); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html new file mode 100644 index 0000000000..f3c7918364 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederr.html @@ -0,0 +1,162 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildnomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildnomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the FIRST item + from the entity reference and execute the "replaceChild(newChild,oldChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +*/ +function nodereplacechildnomodificationallowederr() { + var success; + if(checkInitialization(builder, "nodereplacechildnomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entRef; + var entElement; + var createdNode; + var replacedChild; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entRef = genderNode.firstChild; + + nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + createdNode = doc.createElement("newChild"); + + { + success = false; + try { + replacedChild = entRef.replaceChild(createdNode,entElement); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html new file mode 100644 index 0000000000..e76c030e09 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildnomodificationallowederrEE.html @@ -0,0 +1,144 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildnomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildnomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Create an entity reference execute the "replaceChild(newChild,oldChild)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederr.xml +*/ +function nodereplacechildnomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "nodereplacechildnomodificationallowederrEE") != null) return; + var doc; + var entRef; + var entText; + var createdNode; + var replacedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); +entText = entRef.firstChild; + + createdNode = doc.createElement("newChild"); + + { + success = false; + try { + replacedChild = entRef.replaceChild(createdNode,entText); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html new file mode 100644 index 0000000000..e3fb91496f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodereplacechildoldchildnonexistent.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildoldchildnonexistent</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodereplacechildoldchildnonexistent']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodereplacechildoldchildnonexistent'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "replaceChild(newChild,oldChild)" method raises a + NOT_FOUND_ERR DOMException if the old child is + not a child of this node. + + Retrieve the second employee and attempt to replace a + node that is not one of its children. An attempt to + replace such a node should raise the desired exception. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function nodereplacechildoldchildnonexistent() { + var success; + if(checkInitialization(builder, "nodereplacechildoldchildnonexistent") != null) return; + var doc; + var oldChild; + var newChild; + var elementList; + var elementNode; + var replacedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newChild = doc.createElement("newChild"); + oldChild = doc.createElement("oldChild"); + elementList = doc.getElementsByTagName("employee"); + elementNode = elementList.item(1); + + { + success = false; + try { + replacedNode = elementNode.replaceChild(newChild,oldChild); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 8); + } + assertTrue("throw_NOT_FOUND_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildoldchildnonexistent</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html new file mode 100644 index 0000000000..d4ff0df87f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederr.html @@ -0,0 +1,166 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodesetnodevaluenomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodesetnodevaluenomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setNodeValue(nodeValue)" method causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the SECOND item + from the entity reference and execute the "setNodeValue(nodeValue)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68D080')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodesetnodevaluenomodificationallowederr() { + var success; + if(checkInitialization(builder, "nodesetnodevaluenomodificationallowederr") != null) return; + var doc; + var genderList; + var genderNode; + var entRef; + var entElement; + var entElementText; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entRef = genderNode.firstChild; + + assertNotNull("entRefNotNull",entRef); +nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); // See bug 1663402. + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementText = entElement.firstChild; + + assertNotNull("entElementTextNotNull",entElementText); + + { + success = false; + try { + entElementText.nodeValue = "newValue"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html new file mode 100644 index 0000000000..77ad39229b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodesetnodevaluenomodificationallowederrEE.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodesetnodevaluenomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodesetnodevaluenomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create an entity reference and execute the "setNodeValue(nodeValue)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68D080')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederr.xml +*/ +function nodesetnodevaluenomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "nodesetnodevaluenomodificationallowederrEE") != null) return; + var doc; + var entRef; + var entText; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entRef); +entText = entRef.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + entText.nodeValue = "newValue"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodesetnodevaluenomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html new file mode 100644 index 0000000000..29d9963667 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodeattribute.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodeattribute</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodetextnodeattribute']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodetextnodeattribute'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +The "getAttributes()" method invoked on a Text +Node returns null. + +Retrieve the Text node from the last child of the +first employee and invoke the "getAttributes()" method +on the Text Node. It should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 +*/ +function nodetextnodeattribute() { + var success; + if(checkInitialization(builder, "nodetextnodeattribute") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var attrList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + attrList = textNode.attributes; + + assertNull("nodeTextNodeAttributesAssert1",attrList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodeattribute</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html new file mode 100644 index 0000000000..1ab8a1377e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodename.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodename</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodetextnodename']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodetextnodename'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The string returned by the "getNodeName()" method for a + + Text Node is "#text". + + + + Retrieve the Text Node from the last child of the + + first employee and check the string returned + + by the "getNodeName()" method. It should be equal to + + "#text". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +*/ +function nodetextnodename() { + var success; + if(checkInitialization(builder, "nodetextnodename") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var textName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + textName = textNode.nodeName; + + assertEquals("nodeTextNodeNameAssert1","#text",textName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodename</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html new file mode 100644 index 0000000000..a1dbc06c04 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodetype.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodetype</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodetextnodetype']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodetextnodetype'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + + The "getNodeType()" method for a Text Node + + returns the constant value 3. + + + + Retrieve the Text node from the last child of + + the first employee and invoke the "getNodeType()" + + method. The method should return 3. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 +*/ +function nodetextnodetype() { + var success; + if(checkInitialization(builder, "nodetextnodetype") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + nodeType = textNode.nodeType; + + assertEquals("nodeTextNodeTypeAssert1",3,nodeType); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodetype</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html b/dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html new file mode 100644 index 0000000000..e766122f20 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodetextnodevalue.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodevalue</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodetextnodevalue']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodetextnodevalue'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The string returned by the "getNodeValue()" method for a + Text Node is the content of the Text node. + + Retrieve the Text node from the last child of the first + employee and check the string returned by the + "getNodeValue()" method. It should be equal to + "1230 North Ave. Dallas, Texas 98551". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function nodetextnodevalue() { + var success; + if(checkInitialization(builder, "nodetextnodevalue") != null) return; + var doc; + var elementList; + var testAddr; + var textNode; + var textValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testAddr = elementList.item(0); + textNode = testAddr.firstChild; + + textValue = textNode.nodeValue; + + assertEquals("nodeTextNodeValueAssert1","1230 North Ave. Dallas, Texas 98551",textValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodetextnodevalue</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue01.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue01.html new file mode 100644 index 0000000000..a65253ddc1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue01.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue01</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue01'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An element is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +*/ +function nodevalue01() { + var success; + if(checkInitialization(builder, "nodevalue01") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newNode = doc.createElement("address"); + newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue02.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue02.html new file mode 100644 index 0000000000..253ab373c1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue02.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue02</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue02'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An comment is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 +*/ +function nodevalue02() { + var success; + if(checkInitialization(builder, "nodevalue02") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newNode = doc.createComment("This is a new Comment node"); + newValue = newNode.nodeValue; + + assertEquals("initial","This is a new Comment node",newValue); + newNode.nodeValue = "This should have an effect"; + + newValue = newNode.nodeValue; + + assertEquals("afterChange","This should have an effect",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue03.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue03.html new file mode 100644 index 0000000000..09c088f8ba --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue03.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue03</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue03'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An entity reference is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490 +*/ +function nodevalue03() { + var success; + if(checkInitialization(builder, "nodevalue03") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newNode = doc.createEntityReference("ent1"); + assertNotNull("createdEntRefNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue04.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue04.html new file mode 100644 index 0000000000..cad1d14b54 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue04.html @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue04</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue04'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 +*/ +function nodevalue04() { + var success; + if(checkInitialization(builder, "nodevalue04") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newNode = doc.doctype; + + assertNotNull("docTypeNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue05.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue05.html new file mode 100644 index 0000000000..29829860c1 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue05.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue05</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue05'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 +*/ +function nodevalue05() { + var success; + if(checkInitialization(builder, "nodevalue05") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newNode = doc.createDocumentFragment(); + newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue06.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue06.html new file mode 100644 index 0000000000..e1a81c48cc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue06.html @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue06</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var newNodeRef = null; + if (typeof(this.newNode) != 'undefined') { + newNodeRef = this.newNode; + } + docsLoaded += preload(newNodeRef, "newNode", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue06'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document +*/ +function nodevalue06() { + var success; + if(checkInitialization(builder, "nodevalue06") != null) return; + var newNode; + var newValue; + + var newNodeRef = null; + if (typeof(this.newNode) != 'undefined') { + newNodeRef = this.newNode; + } + newNode = load(newNodeRef, "newNode", "staff"); + newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue07.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue07.html new file mode 100644 index 0000000000..02abb9fe54 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue07.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue07</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue07'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An Entity is accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-527DCFF2 +*/ +function nodevalue07() { + var success; + if(checkInitialization(builder, "nodevalue07") != null) return; + var doc; + var newNode; + var newValue; + var nodeMap; + var docType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +nodeMap = docType.entities; + + assertNotNull("entitiesNotNull",nodeMap); +newNode = nodeMap.getNamedItem("ent1"); + assertNotNull("entityNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue08.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue08.html new file mode 100644 index 0000000000..c91968a3bc --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue08.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue08</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue08'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An notation is accessed, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5431D1B9 +*/ +function nodevalue08() { + var success; + if(checkInitialization(builder, "nodevalue08") != null) return; + var doc; + var docType; + var newNode; + var newValue; + var nodeMap; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +nodeMap = docType.notations; + + assertNotNull("notationsNotNull",nodeMap); +newNode = nodeMap.getNamedItem("notation1"); + assertNotNull("notationNotNull",newNode); +newValue = newNode.nodeValue; + + assertNull("initiallyNull",newValue); + newNode.nodeValue = "This should have no effect"; + + newValue = newNode.nodeValue; + + assertNull("nullAfterAttemptedChange",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_nodevalue09.html b/dom/tests/mochitest/dom-level1-core/test_nodevalue09.html new file mode 100644 index 0000000000..5bdab48a7a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_nodevalue09.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue09</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodevalue09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodevalue09'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* +An processing instruction is created, setNodeValue is called with a non-null argument, but getNodeValue +should still return null. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1004215813 +*/ +function nodevalue09() { + var success; + if(checkInitialization(builder, "nodevalue09") != null) return; + var doc; + var newNode; + var newValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newNode = doc.createProcessingInstruction("TARGET","DATA"); + newValue = newNode.nodeValue; + + assertEquals("initial","DATA",newValue); + newNode.nodeValue = "This should have an effect"; + + newValue = newNode.nodeValue; + + assertEquals("after","This should have an effect",newValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodevalue09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html b/dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html new file mode 100644 index 0000000000..0bc8015087 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_notationgetnotationname.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetnotationname</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['notationgetnotationname']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'notationgetnotationname'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the notation named "notation1" and access its + name by invoking the "getNodeName()" method inherited + from the Node interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5431D1B9 +*/ +function notationgetnotationname() { + var success; + if(checkInitialization(builder, "notationgetnotationname") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var notationName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + notationName = notationNode.nodeName; + + assertEquals("notationGetNotationNameAssert","notation1",notationName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetnotationname</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html new file mode 100644 index 0000000000..af0136188f --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicid.html @@ -0,0 +1,132 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicid</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['notationgetpublicid']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'notationgetpublicid'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the notation named "notation1" and access its + public identifier. The string "notation1File" should be + returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-54F2B4D0 +*/ +function notationgetpublicid() { + var success; + if(checkInitialization(builder, "notationgetpublicid") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var publicId; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + publicId = notationNode.publicId; + + assertEquals("publicId","notation1File",publicId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicid</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html new file mode 100644 index 0000000000..0a96b481ad --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_notationgetpublicidnull.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicidnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['notationgetpublicidnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'notationgetpublicidnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getPublicId()" method of a Notation node contains + the public identifier associated with the notation, if + one was not specified a null value should be returned. + + Retrieve the notation named "notation2" and access its + public identifier. Since a public identifier was not + specified for this notation, the "getPublicId()" method + should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-54F2B4D0 +*/ +function notationgetpublicidnull() { + var success; + if(checkInitialization(builder, "notationgetpublicidnull") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var publicId; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation2"); + publicId = notationNode.publicId; + + assertNull("publicId",publicId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetpublicidnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html new file mode 100644 index 0000000000..d20b2c9a3e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemid.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemid</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['notationgetsystemid']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'notationgetsystemid'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getSystemId()" method of a Notation node contains + the system identifier associated with the notation, if + one was specified. + + Retrieve the notation named "notation2" and access its + system identifier. The string "notation2File" should be + returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E8AAB1D0 +*/ +function notationgetsystemid() { + var success; + if(checkInitialization(builder, "notationgetsystemid") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var systemId; + var index; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation2"); + systemId = notationNode.systemId; + + assertURIEquals("uriEquals",null,null,null,"notation2File",null,null,null,null,systemId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemid</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html new file mode 100644 index 0000000000..eecf8838ac --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_notationgetsystemidnull.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemidnull</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['notationgetsystemidnull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'notationgetsystemidnull'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the notation named "notation1" and access its + system identifier. Since a system identifier was not + specified for this notation, the "getSystemId()" method + should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E8AAB1D0 +*/ +function notationgetsystemidnull() { + var success; + if(checkInitialization(builder, "notationgetsystemidnull") != null) return; + var doc; + var docType; + var notations; + var notationNode; + var systemId; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + docType = doc.doctype; + + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notationNode = notations.getNamedItem("notation1"); + systemId = notationNode.systemId; + + assertNull("systemId",systemId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/notationgetsystemidnull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html new file mode 100644 index 0000000000..18c2449292 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongetdata.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongetdata</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['processinginstructiongetdata']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'processinginstructiongetdata'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getData()" method returns the content of the + processing instruction. It starts at the first non + white character following the target and ends at the + character immediately preceding the "?>". + + Retrieve the ProcessingInstruction node located + immediately after the prolog. Create a nodelist of the + child nodes of this document. Invoke the "getData()" + method on the first child in the list. This should + return the content of the ProcessingInstruction. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 +*/ +function processinginstructiongetdata() { + var success; + if(checkInitialization(builder, "processinginstructiongetdata") != null) return; + var doc; + var childNodes; + var piNode; + var data; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + childNodes = doc.childNodes; + + piNode = childNodes.item(0); + data = piNode.data; + + assertEquals("processinginstructionGetTargetAssert","PIDATA",data); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongetdata</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html new file mode 100644 index 0000000000..7ee9f2f9ec --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_processinginstructiongettarget.html @@ -0,0 +1,133 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongettarget</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['processinginstructiongettarget']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'processinginstructiongettarget'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "getTarget()" method returns the target of the + processing instruction. It is the first token following + the markup that begins the processing instruction. + + Retrieve the ProcessingInstruction node located + immediately after the prolog. Create a nodelist of the + child nodes of this document. Invoke the "getTarget()" + method on the first child in the list. This should + return the target of the ProcessingInstruction. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1478689192 +*/ +function processinginstructiongettarget() { + var success; + if(checkInitialization(builder, "processinginstructiongettarget") != null) return; + var doc; + var childNodes; + var piNode; + var target; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + childNodes = doc.childNodes; + + piNode = childNodes.item(0); + target = piNode.target; + + assertEquals("processinginstructionGetTargetAssert","TEST-STYLE",target); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructiongettarget</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html new file mode 100644 index 0000000000..982272653e --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_processinginstructionsetdatanomodificationallowederr.html @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['processinginstructionsetdatanomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("expandEntityReferences", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'processinginstructionsetdatanomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "setData(data)" method for a processing instruction causes the + DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + if the node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Try to remove the "domestic" attribute + from the entity reference by executing the "setData(data)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-837822393')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 +*/ +function processinginstructionsetdatanomodificationallowederr() { + var success; + if(checkInitialization(builder, "processinginstructionsetdatanomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var piNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = gender.firstChild; + + assertNotNull("entRefNotNull",entRef); +piNode = entRef.lastChild; + + assertNotNull("piNodeNotNull",piNode); + + { + success = false; + try { + piNode.data = "newData"; + + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html new file mode 100644 index 0000000000..7ca01c6ea3 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerrnegativeoffset.html @@ -0,0 +1,145 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerrnegativeoffset</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textindexsizeerrnegativeoffset']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + setImplementationAttribute("signed", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textindexsizeerrnegativeoffset'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset is + negative. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The desired exception should be raised since the offset + is a negative number. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +*/ +function textindexsizeerrnegativeoffset() { + var success; + if(checkInitialization(builder, "textindexsizeerrnegativeoffset") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + + { + success = false; + try { + splitNode = textNode.splitText(-69); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throws_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerrnegativeoffset</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html new file mode 100644 index 0000000000..1a556ae14b --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textindexsizeerroffsetoutofbounds.html @@ -0,0 +1,146 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerroffsetoutofbounds</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textindexsizeerroffsetoutofbounds']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textindexsizeerroffsetoutofbounds'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method raises an + INDEX_SIZE_ERR DOMException if the specified offset is + greater than the number of characters in the Text node. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The desired exception should be raised since the offset + is a greater than the number of characters in the Text + node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 +*/ +function textindexsizeerroffsetoutofbounds() { + var success; + if(checkInitialization(builder, "textindexsizeerroffsetoutofbounds") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + + { + success = false; + try { + splitNode = textNode.splitText(300); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 1); + } + assertTrue("throw_INDEX_SIZE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerroffsetoutofbounds</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html b/dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html new file mode 100644 index 0000000000..9c2e46ab5a --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textparseintolistofelements.html @@ -0,0 +1,184 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textparseintolistofelements</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textparseintolistofelements']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textparseintolistofelements'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Retrieve the textual data from the last child of the + second employee. That node is composed of two + EntityReference nodes and two Text nodes. After + the content node is parsed, the "address" Element + should contain four children with each one of the + EntityReferences containing one child. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-745549614 +*/ +function textparseintolistofelements() { + var success; + if(checkInitialization(builder, "textparseintolistofelements") != null) return; + var doc; + var elementList; + var addressNode; + var childList; + var child; + var length; + var value; + var grandChild; + var result = new Array(); + + expectedNormal = new Array(); + expectedNormal[0] = "1900 Dallas Road"; + expectedNormal[1] = " Dallas, "; + expectedNormal[2] = "Texas"; + expectedNormal[3] = "\n 98554"; + + expectedExpanded = new Array(); + expectedExpanded[0] = "1900 Dallas Road Dallas, Texas\n 98554"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + addressNode = elementList.item(1); + childList = addressNode.childNodes; + + length = childList.length; + + for(var indexN65663 = 0;indexN65663 < childList.length; indexN65663++) { + child = childList.item(indexN65663); + value = child.nodeValue; + + + if( + + (value == null) + + ) { + grandChild = child.firstChild; + + assertNotNull("grandChildNotNull",grandChild); +value = grandChild.nodeValue; + + result[result.length] = value; + + } + + else { + result[result.length] = value; + + } + + } + + if( + (4 == length) + ) { + assertEqualsList("assertEqNormal",expectedNormal,result); + + } + + else { + assertEqualsList("assertEqCoalescing",expectedExpanded,result); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textparseintolistofelements</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html new file mode 100644 index 0000000000..348ee8af05 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextfour.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextfour</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textsplittextfour']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textsplittextfour'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method returns the new Text node. + + Retrieve the textual data from the last child of the + first employee and invoke the "splitText(offset)" method. + The method should return the new Text node. The offset + value used for this test is 30. The "getNodeValue()" + method is called to check that the new node now contains + the characters at and after position 30. + (Starting count at 0) + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function textsplittextfour() { + var success; + if(checkInitialization(builder, "textsplittextfour") != null) return; + var doc; + var elementList; + var addressNode; + var textNode; + var splitNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + addressNode = elementList.item(0); + textNode = addressNode.firstChild; + + splitNode = textNode.splitText(30); + value = splitNode.nodeValue; + + assertEquals("textSplitTextFourAssert","98551",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextfour</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html new file mode 100644 index 0000000000..fc04bb0c53 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederr.html @@ -0,0 +1,165 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederr</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textsplittextnomodificationallowederr']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textsplittextnomodificationallowederr'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method raises a + NO_MODIFICATION_ALLOWED_ERR DOMException if the + node is readonly. + + Obtain the children of the THIRD "gender" element. The elements + content is an entity reference. Get the element content of the FIRST + Text Node of the entity reference and execute the "splitText(offset)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function textsplittextnomodificationallowederr() { + var success; + if(checkInitialization(builder, "textsplittextnomodificationallowederr") != null) return; + var doc; + var genderList; + var gender; + var entRef; + var entElement; + var entElementText; + var splitNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + entRef = gender.firstChild; + + assertNotNull("entRefNotNull",entRef); +nodeType = entRef.nodeType; + + + if( + (1 == nodeType) + ) { + entRef = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",entRef); + + } + entElement = entRef.firstChild; + + assertNotNull("entElementNotNull",entElement); +entElementText = entElement.firstChild; + + assertNotNull("entElementTextNotNull",entElementText); + + { + success = false; + try { + splitNode = entElementText.splitText(2); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederr</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html new file mode 100644 index 0000000000..2d3a132e13 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextnomodificationallowederrEE.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederrEE</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textsplittextnomodificationallowederrEE']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textsplittextnomodificationallowederrEE'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + Create an ent3 reference and execute the "splitText(offset)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author Curt Arnold +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +* @see http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederr.xml +*/ +function textsplittextnomodificationallowederrEE() { + var success; + if(checkInitialization(builder, "textsplittextnomodificationallowederrEE") != null) return; + var doc; + var entRef; + var entText; + var splitNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + entRef = doc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entRef); +entText = entRef.firstChild; + + assertNotNull("entTextNotNull",entText); + + { + success = false; + try { + splitNode = entText.splitText(2); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextnomodificationallowederrEE</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextone.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextone.html new file mode 100644 index 0000000000..4467b77118 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextone.html @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextone</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textsplittextone']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textsplittextone'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + The "splitText(offset)" method breaks the Text node into + two Text nodes at the specified offset keeping each node + as siblings in the tree. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The method splits the Text node into two new sibling + Text nodes keeping both of them in the tree. This test + checks the "nextSibling()" method of the original node + to ensure that the two nodes are indeed siblings. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function textsplittextone() { + var success; + if(checkInitialization(builder, "textsplittextone") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + var secondPart; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + splitNode = textNode.splitText(7); + secondPart = textNode.nextSibling; + + value = secondPart.nodeValue; + + assertEquals("textSplitTextOneAssert","Jones",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextone</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html b/dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html new file mode 100644 index 0000000000..e02dd2e501 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textsplittextthree.html @@ -0,0 +1,139 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextthree</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textsplittextthree']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textsplittextthree'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + After the "splitText(offset)" method breaks the Text node + into two Text nodes, the new Text node contains all the + content at and after the offset point. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The new Text node should contain all the content + at and after the offset point. The "getNodeValue()" + method is called to check that the new node now contains + the characters at and after position seven. + (Starting count at 0) + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function textsplittextthree() { + var success; + if(checkInitialization(builder, "textsplittextthree") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + splitNode = textNode.splitText(6); + value = splitNode.nodeValue; + + assertEquals("textSplitTextThreeAssert"," Jones",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittextthree</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html b/dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html new file mode 100644 index 0000000000..daed27c6f8 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textsplittexttwo.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittexttwo</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textsplittexttwo']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textsplittexttwo'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + After the "splitText(offset)" method breaks the Text node + into two Text nodes, the original node contains all the + content up to the offset point. + + Retrieve the textual data from the second child of the + third employee and invoke the "splitText(offset)" method. + The original Text node should contain all the content + up to the offset point. The "getNodeValue()" method + is called to check that the original node now contains + the first five characters. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D +*/ +function textsplittexttwo() { + var success; + if(checkInitialization(builder, "textsplittexttwo") != null) return; + var doc; + var elementList; + var nameNode; + var textNode; + var splitNode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(2); + textNode = nameNode.firstChild; + + splitNode = textNode.splitText(5); + value = textNode.nodeValue; + + assertEquals("textSplitTextTwoAssert","Roger",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textsplittexttwo</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html b/dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html new file mode 100644 index 0000000000..cc349c2426 --- /dev/null +++ b/dom/tests/mochitest/dom-level1-core/test_textwithnomarkup.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level1/core/textwithnomarkup</title> +<link href="activity-home.css" rel="stylesheet" type="text/css"> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['textwithnomarkup']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'textwithnomarkup'; + + + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(setUpPage); + + +/** +* + If there is not any markup inside an Element or Attr node + content, then the text is contained in a single object + implementing the Text interface that is the only child + of the element. + + Retrieve the textual data from the second child of the + third employee. That Text node contains a block of + multiple text lines without markup, so they should be + treated as a single Text node. The "getNodeValue()" + method should contain the combination of the two lines. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 +*/ +function textwithnomarkup() { + var success; + if(checkInitialization(builder, "textwithnomarkup") != null) return; + var doc; + var elementList; + var nameNode; + var nodeV; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("name"); + nameNode = elementList.item(2); + nodeV = nameNode.firstChild; + + value = nodeV.nodeValue; + + assertEquals("textNodeValue","Roger\n Jones",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level1/core/textwithnomarkup</h2> +<p></p> +<p> +Copyright (c) 2001-2004 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 <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> 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. +</p> +</body> +</html> |