diff options
Diffstat (limited to '')
266 files changed, 37540 insertions, 0 deletions
diff --git a/dom/tests/mochitest/dom-level2-core/DOMTestCase.js b/dom/tests/mochitest/dom-level2-core/DOMTestCase.js new file mode 100644 index 0000000000..2d2b2cf645 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/DOMTestCase.js @@ -0,0 +1,710 @@ +/* +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); +} + +window.doc = window; +SimpleTest.waitForExplicitFinish(); +addLoadEvent(function(){ setUpPage(); }); + +// Actual marking code is in overrideSTlR() now. +function markTodos() { + if (todoTests[docName]) { + isnot(gFailuresAsTodos, 0, "test marked todo should have failed somewhere"); + } +} + +function runJSUnitTests() { + builder = createConfiguredBuilder(); + 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-level2-core/exclusions.js b/dom/tests/mochitest/dom-level2-core/exclusions.js new file mode 100644 index 0000000000..cc5a0da12f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/exclusions.js @@ -0,0 +1,50 @@ +/* -*- 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/. */ + +dtdTests = ["attrgetownerelement01", "documentimportnode03", + "documentimportnode04", "documentimportnode19", + "documentimportnode20", "documentimportnode21", + "documentimportnode22", + "elementgetattributenodens03", "elementgetattributens02", + "elementhasattribute02", "getAttributeNS01", "getElementById01", + "getNamedItemNS03", "getNamedItemNS04", "hasAttribute02", + "hasAttributeNS04", "importNode07", "importNode09", + "importNode10", "importNode11", "importNode12", "importNode13", + "localName02", "namednodemapgetnameditemns01", + "namednodemapremovenameditemns02", + "namednodemapremovenameditemns05", "namednodemapsetnameditemns05", + "namednodemapsetnameditemns09", "namednodemapsetnameditemns10", + "namednodemapsetnameditemns11", "namespaceURI01", + "nodeissupported04", "nodenormalize01", "nodesetprefix04", + "prefix08", "removeAttributeNS01", "removeAttributeNS02", + "removeNamedItemNS03", "setAttributeNodeNS02", "setAttributeNS03", + "setNamedItemNS04"]; + +bug371552 = ["elementhasattributens02"]; +wrongDocError = ["elementsetattributenodens05", "namednodemapsetnameditemns03", + "setAttributeNodeNS05", "setNamedItemNS02"]; +attrExodus = ["elementsetattributenodens06", "importNode01", + "hc_namednodemapinvalidtype1", "nodehasattributes02"]; +bogusPrefix = ["nodesetprefix05", "nodesetprefix09", "prefix06", "prefix07"]; +prefixReplacement = ["setAttributeNodeNS04"]; + +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 todoTests = {}; +var exclusions = concat(dtdTests, bug371552, wrongDocError, attrExodus, + bogusPrefix, prefixReplacement); +for (var excludedTestName in exclusions) { + todoTests[exclusions[excludedTestName]] = true; +} diff --git a/dom/tests/mochitest/dom-level2-core/files/hc_staff.html b/dom/tests/mochitest/dom-level2-core/files/hc_staff.html new file mode 100644 index 0000000000..9acf750493 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/hc_staff.svg b/dom/tests/mochitest/dom-level2-core/files/hc_staff.svg new file mode 100644 index 0000000000..cd0cc47f9a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/hc_staff.xhtml b/dom/tests/mochitest/dom-level2-core/files/hc_staff.xhtml new file mode 100644 index 0000000000..2df9a74154 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/hc_staff.xml b/dom/tests/mochitest/dom-level2-core/files/hc_staff.xml new file mode 100644 index 0000000000..2df9a74154 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/internalSubset01.js b/dom/tests/mochitest/dom-level2-core/files/internalSubset01.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/internalSubset01.js diff --git a/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg new file mode 100644 index 0000000000..01aa823f35 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.svg @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="100" height="100"/> + <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> +</svg> diff --git a/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml new file mode 100644 index 0000000000..054a5e1808 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/nodtdstaff.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<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> +</staff> diff --git a/dom/tests/mochitest/dom-level2-core/files/staff.dtd b/dom/tests/mochitest/dom-level2-core/files/staff.dtd new file mode 100644 index 0000000000..02a994d57d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/staff.svg b/dom/tests/mochitest/dom-level2-core/files/staff.svg new file mode 100644 index 0000000000..fd67323a46 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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">&svgtest;&svgunit;</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-level2-core/files/staff.xml b/dom/tests/mochitest/dom-level2-core/files/staff.xml new file mode 100644 index 0000000000..f89c5107db --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/staff2.dtd b/dom/tests/mochitest/dom-level2-core/files/staff2.dtd new file mode 100644 index 0000000000..0bac8f2539 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/staff2.dtd @@ -0,0 +1,24 @@ +<!ELEMENT employeeId (#PCDATA)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT position (#PCDATA)> +<!ELEMENT salary (#PCDATA)> +<!ELEMENT address (#PCDATA)> +<!ELEMENT gender ( #PCDATA)> +<!ELEMENT employee (employeeId, name, position, salary, gender, address) > +<!ATTLIST employee xmlns CDATA #IMPLIED> +<!ELEMENT staff (employee)+> +<!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 "internalSubset01.js"> + diff --git a/dom/tests/mochitest/dom-level2-core/files/staff2.svg b/dom/tests/mochitest/dom-level2-core/files/staff2.svg new file mode 100644 index 0000000000..6f89dad04a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/staff2.svg @@ -0,0 +1,13 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?>
+<!DOCTYPE svg SYSTEM "staff2.dtd" []>
+<!-- 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>
+ <employee xmlns="http://www.example.com">
+ <employeeId>EMP0001</employeeId>
+ <name>Margaret Martin</name>
+ <position>Accountant</position>
+ <salary>56,000</salary>
+ <gender>Female</gender>
+ <address>1230 North Ave. Dallas, Texas 98551</address>
+ </employee>
+ </svg>
diff --git a/dom/tests/mochitest/dom-level2-core/files/staff2.xml b/dom/tests/mochitest/dom-level2-core/files/staff2.xml new file mode 100644 index 0000000000..d3d9a13dd6 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/staff2.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE staff SYSTEM "staff2.dtd" []> +<!-- 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>1230 North Ave. Dallas, Texas 98551</address> + </employee> + </staff> diff --git a/dom/tests/mochitest/dom-level2-core/files/staffNS.dtd b/dom/tests/mochitest/dom-level2-core/files/staffNS.dtd new file mode 100644 index 0000000000..7643773fc8 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/staffNS.dtd @@ -0,0 +1,45 @@ +<!ELEMENT staff (employee+,emp:employee,employee) > +<!ELEMENT employee (employeeId,name,position,salary,gender,address) > +<!ATTLIST employee xmlns CDATA #IMPLIED> +<!ATTLIST employee xmlns:dmstc CDATA #IMPLIED> +<!ATTLIST employee xmlns:emp2 CDATA #IMPLIED> + +<!ELEMENT employeeId (#PCDATA) > + +<!ELEMENT name (#PCDATA) > + +<!ELEMENT position (#PCDATA) > + +<!ELEMENT salary (#PCDATA) > + +<!ELEMENT entElement1 (#PCDATA) > +<!ELEMENT gender (#PCDATA | entElement1)* > +<!ATTLIST entElement1 xmlns:local1 CDATA #IMPLIED > + +<!ELEMENT address (#PCDATA) > +<!ATTLIST address dmstc:domestic CDATA #IMPLIED> +<!ATTLIST address street CDATA #IMPLIED> +<!ATTLIST address domestic CDATA #IMPLIED> +<!ATTLIST address xmlns CDATA #IMPLIED> + +<!ELEMENT emp:employee (emp:employeeId,nm:name,emp:position,emp:salary,emp:gender,emp:address) > +<!ATTLIST emp:employee xmlns:emp CDATA #IMPLIED> +<!ATTLIST emp:employee xmlns:nm CDATA #IMPLIED> +<!ATTLIST emp:employee defaultAttr CDATA 'defaultVal'> + +<!ELEMENT emp:employeeId (#PCDATA) > + +<!ELEMENT nm:name (#PCDATA) > + +<!ELEMENT emp:position (#PCDATA) > + +<!ELEMENT emp:salary (#PCDATA) > + +<!ELEMENT emp:gender (#PCDATA) > + +<!ELEMENT emp:address (#PCDATA) > +<!ATTLIST emp:address emp:domestic CDATA #IMPLIED> +<!ATTLIST emp:address street CDATA #IMPLIED> +<!ATTLIST emp:address emp:zone ID #IMPLIED> +<!ATTLIST emp:address emp:district CDATA 'DISTRICT'> +<!ATTLIST emp:address emp:local1 CDATA 'FALSE'> diff --git a/dom/tests/mochitest/dom-level2-core/files/staffNS.svg b/dom/tests/mochitest/dom-level2-core/files/staffNS.svg new file mode 100644 index 0000000000..7a7c26ee89 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/staffNS.svg @@ -0,0 +1,73 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE svg PUBLIC "STAFF" "staffNS.dtd" +[ + <!ENTITY ent1 "es"> + <!ENTITY ent2 "1900 Dallas Road"> + <!ENTITY ent3 "Texas"> + <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>"> + <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> + <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2> + <!ENTITY ent1 "This entity should be discarded"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> + <!ELEMENT svg (rect, script, employee+, emp:employee, 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">&svgtest;&svgunit;</script> + <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com"> + <employeeId>EMP0001</employeeId> + <name>Margaret Martin</name> + <position>Accountant</position> + <salary>56,000</salary> + <gender>Female</gender> + <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address> + </employee> + <employee xmlns:dmstc="http://www.usa.com" xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2/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 dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3; + 98554</address> + </employee> + <employee xmlns:dmstc="http://www.netzero.com" xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files"> + <employeeId>EMP0003</employeeId> + <name>Roger + Jones</name> + <position>Department Manager</position> + <salary>100,000</salary> + <gender>&ent4;</gender> + <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address> + </employee> + <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId> + <nm:name>Jeny Oconnor</nm:name> + <emp:position>Personnel Director</emp:position> + <emp:salary>95,000</emp:salary> + <emp:gender>Female</emp:gender> + <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address> + </emp:employee> + <employee xmlns:emp2="http://www.nist.gov" xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files"> + <employeeId>EMP0005</employeeId> + <name>Robert Myers</name> + <position>Computer Specialist</position> + <salary>90,000</salary> + <gender>male</gender> + <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address> + </employee> + </svg> diff --git a/dom/tests/mochitest/dom-level2-core/files/staffNS.xml b/dom/tests/mochitest/dom-level2-core/files/staffNS.xml new file mode 100644 index 0000000000..1cb1459e23 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/staffNS.xml @@ -0,0 +1,59 @@ +<?xml version="1.0"?><?TEST-STYLE PIDATA?> +<!DOCTYPE staff PUBLIC "STAFF" "staffNS.dtd" +[ + <!ENTITY ent1 "es"> + <!ENTITY ent2 "1900 Dallas Road"> + <!ENTITY ent3 "Texas"> + <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>"> + <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> + <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2> + <!ENTITY ent1 "This entity should be discarded"> + <!NOTATION notation1 PUBLIC "notation1File"> + <!NOTATION notation2 SYSTEM "notation2File"> +]> +<!-- This is comment number 1.--> +<staff> + <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com"> + <employeeId>EMP0001</employeeId> + <name>Margaret Martin</name> + <position>Accountant</position> + <salary>56,000</salary> + <gender>Female</gender> + <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address> + </employee> + <employee xmlns:dmstc="http://www.usa.com"> + <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 dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3; + 98554</address> + </employee> + <employee xmlns:dmstc="http://www.netzero.com"> + <employeeId>EMP0003</employeeId> + <name>Roger + Jones</name> + <position>Department Manager</position> + <salary>100,000</salary> + <gender>&ent4;</gender> + <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address> + </employee> + <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId> + <nm:name>Jeny Oconnor</nm:name> + <emp:position>Personnel Director</emp:position> + <emp:salary>95,000</emp:salary> + <emp:gender>Female</emp:gender> + <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address> + </emp:employee> + <employee xmlns:emp2="http://www.nist.gov"> + <employeeId>EMP0005</employeeId> + <name>Robert Myers</name> + <position>Computer Specialist</position> + <salary>90,000</salary> + <gender>male</gender> + <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address> + </employee> + </staff> diff --git a/dom/tests/mochitest/dom-level2-core/files/svgtest.js b/dom/tests/mochitest/dom-level2-core/files/svgtest.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/svgtest.js diff --git a/dom/tests/mochitest/dom-level2-core/files/svgunit.js b/dom/tests/mochitest/dom-level2-core/files/svgunit.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/files/svgunit.js diff --git a/dom/tests/mochitest/dom-level2-core/files/xhtml-lat1.ent b/dom/tests/mochitest/dom-level2-core/files/xhtml-lat1.ent new file mode 100644 index 0000000000..ffee223eb1 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/xhtml-special.ent b/dom/tests/mochitest/dom-level2-core/files/xhtml-special.ent new file mode 100644 index 0000000000..ca358b2fec --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/xhtml-symbol.ent b/dom/tests/mochitest/dom-level2-core/files/xhtml-symbol.ent new file mode 100644 index 0000000000..63c2abfa6f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/xhtml1-frameset.dtd b/dom/tests/mochitest/dom-level2-core/files/xhtml1-frameset.dtd new file mode 100644 index 0000000000..dc5d7936cc --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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/28 22:59:26 $ + +--> + +<!--================ 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-level2-core/files/xhtml1-strict.dtd b/dom/tests/mochitest/dom-level2-core/files/xhtml1-strict.dtd new file mode 100644 index 0000000000..fefb77f4f0 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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-level2-core/files/xhtml1-transitional.dtd b/dom/tests/mochitest/dom-level2-core/files/xhtml1-transitional.dtd new file mode 100644 index 0000000000..3cad0fbaea --- /dev/null +++ b/dom/tests/mochitest/dom-level2-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/28 22:59:26 $ + +--> + +<!--================ 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-level2-core/mochitest.toml b/dom/tests/mochitest/dom-level2-core/mochitest.toml new file mode 100644 index 0000000000..0c0e5366cf --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/mochitest.toml @@ -0,0 +1,511 @@ +[DEFAULT] +support-files = [ + "DOMTestCase.js", + "exclusions.js", + "files/hc_staff.html", + "files/hc_staff.svg", + "files/hc_staff.xhtml", + "files/hc_staff.xml", + "files/internalSubset01.js", + "files/nodtdstaff.svg", + "files/nodtdstaff.xml", + "files/staff.dtd", + "files/staff.svg", + "files/staff.xml", + "files/staff2.dtd", + "files/staff2.svg", + "files/staff2.xml", + "files/staffNS.dtd", + "files/staffNS.svg", + "files/staffNS.xml", + "files/svgtest.js", + "files/svgunit.js", + "files/xhtml-lat1.ent", + "files/xhtml-special.ent", + "files/xhtml-symbol.ent", + "files/xhtml1-frameset.dtd", + "files/xhtml1-strict.dtd", + "files/xhtml1-transitional.dtd", +] + +["test_attrgetownerelement01.html"] + +["test_attrgetownerelement02.html"] + +["test_attrgetownerelement03.html"] + +["test_attrgetownerelement04.html"] + +["test_attrgetownerelement05.html"] + +["test_createAttributeNS01.html"] + +["test_createAttributeNS02.html"] + +["test_createAttributeNS03.html"] + +["test_createAttributeNS04.html"] + +["test_createAttributeNS05.html"] + +["test_createAttributeNS06.html"] + +["test_createDocument01.html"] + +["test_createDocument02.html"] + +["test_createDocument03.html"] + +["test_createDocument04.html"] + +["test_createDocument05.html"] + +["test_createDocument06.html"] + +["test_createDocument07.html"] + +["test_createDocumentType01.html"] + +["test_createDocumentType02.html"] + +["test_createDocumentType03.html"] + +["test_createElementNS01.html"] + +["test_createElementNS02.html"] + +["test_createElementNS03.html"] + +["test_createElementNS04.html"] + +["test_createElementNS05.html"] + +["test_createElementNS06.html"] + +["test_documentcreateattributeNS01.html"] + +["test_documentcreateattributeNS02.html"] + +["test_documentcreateattributeNS03.html"] + +["test_documentcreateattributeNS04.html"] + +["test_documentcreateattributeNS05.html"] + +["test_documentcreateattributeNS06.html"] + +["test_documentcreateattributeNS07.html"] + +["test_documentcreateelementNS01.html"] + +["test_documentcreateelementNS02.html"] + +["test_documentcreateelementNS05.html"] + +["test_documentcreateelementNS06.html"] + +["test_documentgetelementbyid01.html"] + +["test_documentgetelementsbytagnameNS01.html"] + +["test_documentgetelementsbytagnameNS02.html"] + +["test_documentgetelementsbytagnameNS03.html"] + +["test_documentgetelementsbytagnameNS04.html"] + +["test_documentgetelementsbytagnameNS05.html"] + +["test_documentimportnode01.html"] + +["test_documentimportnode02.html"] + +["test_documentimportnode03.html"] +skip-if = [ + "http3", + "http2", +] + +["test_documentimportnode04.html"] + +["test_documentimportnode05.html"] + +["test_documentimportnode06.html"] + +["test_documentimportnode07.html"] + +["test_documentimportnode08.html"] + +["test_documentimportnode09.html"] + +["test_documentimportnode10.html"] + +["test_documentimportnode11.html"] + +["test_documentimportnode12.html"] + +["test_documentimportnode13.html"] + +["test_documentimportnode14.html"] + +["test_documentimportnode15.html"] + +["test_documentimportnode17.html"] + +["test_documentimportnode18.html"] + +["test_documentimportnode19.html"] + +["test_documentimportnode20.html"] + +["test_documentimportnode21.html"] + +["test_documentimportnode22.html"] + +["test_documenttypepublicid01.html"] + +["test_documenttypesystemid01.html"] + +["test_domimplementationcreatedocument03.html"] + +["test_domimplementationcreatedocument04.html"] + +["test_domimplementationcreatedocument05.html"] + +["test_domimplementationcreatedocument07.html"] + +["test_domimplementationcreatedocumenttype01.html"] + +["test_domimplementationcreatedocumenttype02.html"] + +["test_domimplementationcreatedocumenttype04.html"] + +["test_domimplementationfeaturecore.html"] + +["test_domimplementationfeaturexmlversion2.html"] + +["test_domimplementationhasfeature01.html"] + +["test_elementgetattributenodens01.html"] + +["test_elementgetattributenodens02.html"] + +["test_elementgetattributenodens03.html"] + +["test_elementgetattributens02.html"] + +["test_elementgetelementsbytagnamens02.html"] + +["test_elementgetelementsbytagnamens04.html"] + +["test_elementgetelementsbytagnamens05.html"] + +["test_elementhasattribute01.html"] + +["test_elementhasattribute02.html"] + +["test_elementhasattribute03.html"] + +["test_elementhasattribute04.html"] + +["test_elementhasattributens01.html"] + +["test_elementhasattributens02.html"] + +["test_elementhasattributens03.html"] + +["test_elementremoveattributens01.html"] + +["test_elementsetattributenodens01.html"] + +["test_elementsetattributenodens02.html"] + +["test_elementsetattributenodens03.html"] + +["test_elementsetattributenodens04.html"] + +["test_elementsetattributenodens05.html"] + +["test_elementsetattributenodens06.html"] + +["test_elementsetattributens01.html"] + +["test_elementsetattributens02.html"] + +["test_elementsetattributens03.html"] + +["test_elementsetattributens04.html"] + +["test_elementsetattributens05.html"] + +["test_elementsetattributens08.html"] + +["test_elementsetattributensurinull.html"] + +["test_getAttributeNS01.html"] + +["test_getAttributeNS02.html"] + +["test_getAttributeNS03.html"] + +["test_getAttributeNS04.html"] + +["test_getAttributeNS05.html"] + +["test_getAttributeNodeNS01.html"] + +["test_getAttributeNodeNS02.html"] + +["test_getElementById01.html"] + +["test_getElementById02.html"] + +["test_getElementsByTagNameNS01.html"] + +["test_getElementsByTagNameNS02.html"] + +["test_getElementsByTagNameNS03.html"] + +["test_getElementsByTagNameNS04.html"] + +["test_getElementsByTagNameNS05.html"] + +["test_getElementsByTagNameNS06.html"] + +["test_getElementsByTagNameNS07.html"] + +["test_getElementsByTagNameNS08.html"] + +["test_getElementsByTagNameNS09.html"] + +["test_getElementsByTagNameNS10.html"] + +["test_getElementsByTagNameNS11.html"] + +["test_getElementsByTagNameNS12.html"] + +["test_getElementsByTagNameNS13.html"] + +["test_getElementsByTagNameNS14.html"] + +["test_getNamedItemNS01.html"] + +["test_getNamedItemNS02.html"] + +["test_getNamedItemNS03.html"] + +["test_getNamedItemNS04.html"] + +["test_hasAttribute01.html"] + +["test_hasAttribute02.html"] + +["test_hasAttribute03.html"] + +["test_hasAttribute04.html"] + +["test_hasAttributeNS01.html"] + +["test_hasAttributeNS02.html"] + +["test_hasAttributeNS03.html"] + +["test_hasAttributeNS04.html"] + +["test_hasAttributeNS05.html"] + +["test_hasAttributes01.html"] + +["test_hasAttributes02.html"] + +["test_hc_namednodemapinvalidtype1.html"] + +["test_hc_nodedocumentfragmentnormalize1.html"] + +["test_hc_nodedocumentfragmentnormalize2.html"] + +["test_importNode01.html"] + +["test_importNode02.html"] + +["test_importNode03.html"] + +["test_importNode04.html"] + +["test_importNode05.html"] + +["test_importNode06.html"] + +["test_importNode07.html"] + +["test_importNode08.html"] + +["test_importNode09.html"] + +["test_importNode10.html"] + +["test_importNode11.html"] + +["test_importNode12.html"] + +["test_importNode13.html"] + +["test_importNode14.html"] + +["test_importNode15.html"] + +["test_importNode16.html"] + +["test_importNode17.html"] + +["test_localName01.html"] + +["test_localName02.html"] + +["test_localName04.html"] + +["test_namednodemapgetnameditemns01.html"] + +["test_namednodemapgetnameditemns02.html"] + +["test_namednodemapgetnameditemns03.html"] + +["test_namednodemapgetnameditemns04.html"] + +["test_namednodemapgetnameditemns05.html"] + +["test_namednodemapgetnameditemns06.html"] + +["test_namednodemapremovenameditemns01.html"] + +["test_namednodemapremovenameditemns02.html"] + +["test_namednodemapremovenameditemns03.html"] + +["test_namednodemapremovenameditemns04.html"] + +["test_namednodemapremovenameditemns05.html"] + +["test_namednodemapremovenameditemns06.html"] + +["test_namednodemapremovenameditemns07.html"] + +["test_namednodemapremovenameditemns08.html"] + +["test_namednodemapremovenameditemns09.html"] + +["test_namednodemapsetnameditemns01.html"] + +["test_namednodemapsetnameditemns02.html"] + +["test_namednodemapsetnameditemns03.html"] + +["test_namednodemapsetnameditemns04.html"] + +["test_namednodemapsetnameditemns05.html"] + +["test_namednodemapsetnameditemns06.html"] + +["test_namednodemapsetnameditemns07.html"] + +["test_namednodemapsetnameditemns08.html"] + +["test_namednodemapsetnameditemns09.html"] + +["test_namednodemapsetnameditemns10.html"] + +["test_namednodemapsetnameditemns11.html"] + +["test_namespaceURI01.html"] + +["test_namespaceURI02.html"] + +["test_namespaceURI03.html"] + +["test_namespaceURI04.html"] + +["test_nodegetlocalname03.html"] + +["test_nodegetnamespaceuri03.html"] + +["test_nodegetownerdocument01.html"] + +["test_nodegetownerdocument02.html"] + +["test_nodegetprefix03.html"] + +["test_nodehasattributes01.html"] + +["test_nodehasattributes02.html"] + +["test_nodehasattributes03.html"] + +["test_nodehasattributes04.html"] + +["test_nodenormalize01.html"] + +["test_normalize01.html"] + +["test_ownerDocument01.html"] + +["test_ownerElement01.html"] + +["test_ownerElement02.html"] + +["test_prefix01.html"] + +["test_prefix03.html"] + +["test_prefix04.html"] + +["test_publicId01.html"] + +["test_removeAttributeNS01.html"] + +["test_removeAttributeNS02.html"] + +["test_removeNamedItemNS01.html"] + +["test_removeNamedItemNS02.html"] + +["test_removeNamedItemNS03.html"] + +["test_setAttributeNS01.html"] + +["test_setAttributeNS02.html"] + +["test_setAttributeNS03.html"] + +["test_setAttributeNS04.html"] + +["test_setAttributeNS05.html"] + +["test_setAttributeNS06.html"] + +["test_setAttributeNS07.html"] + +["test_setAttributeNS09.html"] + +["test_setAttributeNS10.html"] + +["test_setAttributeNodeNS01.html"] + +["test_setAttributeNodeNS02.html"] + +["test_setAttributeNodeNS03.html"] + +["test_setAttributeNodeNS04.html"] + +["test_setAttributeNodeNS05.html"] + +["test_setNamedItemNS01.html"] + +["test_setNamedItemNS02.html"] + +["test_setNamedItemNS03.html"] + +["test_setNamedItemNS04.html"] + +["test_setNamedItemNS05.html"] + +["test_systemId01.html"] diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.html new file mode 100644 index 0000000000..ca066a49b7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement01.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/level2/core/attrgetownerelement01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrgetownerelement01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrgetownerelement01'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute is attached to or + null if this attribute is not in use. + + Retreive the default attribute defaultAttr and check its owner element. Verify if the name + the nodeName of the returned ownerElement is emp:employee. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function attrgetownerelement01() { + var success; + if(checkInitialization(builder, "attrgetownerelement01") != null) return; + var doc; + var attr; + var element; + var ownerElement; + var ownerElementName; + var elementList; + var attributes; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = elementList.item(1); + attributes = element.attributes; + + attr = attributes.getNamedItemNS(nullNS,"defaultAttr"); + ownerElement = attr.ownerElement; + + ownerElementName = ownerElement.nodeName; + + assertEquals("attrgetownerelement01","emp:employee",ownerElementName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.html new file mode 100644 index 0000000000..b84f71c79f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement02.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/level2/core/attrgetownerelement02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrgetownerelement02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrgetownerelement02'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute + is attached to or null if this attribute is not in use. + + Create a new element and attribute node, attach the attribute to the element. + Check the value of owner element of the new attribute node + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement +*/ +function attrgetownerelement02() { + var success; + if(checkInitialization(builder, "attrgetownerelement02") != null) return; + var doc; + var element; + var ownerElement; + var ownerElementName; + var attr; + var newAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElement("root"); + attr = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); + newAttr = element.setAttributeNodeNS(attr); + ownerElement = attr.ownerElement; + + ownerElementName = ownerElement.nodeName; + + assertEquals("attrgetownerelement02","root".toLowerCase(),ownerElementName.toLowerCase()); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html new file mode 100644 index 0000000000..115574f500 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement03.html @@ -0,0 +1,119 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrgetownerelement03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrgetownerelement03'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute + is attached to or null if this attribute is not in use. + + Create a new attribute node for this document node. Since the newly attribute is + not it use its owner element should be null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement +*/ +function attrgetownerelement03() { + var success; + if(checkInitialization(builder, "attrgetownerelement03") != null) return; + var doc; + var ownerElement; + var attr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + attr = doc.createAttributeNS("http://www.w3.org/DOM","dom:attr"); + ownerElement = attr.ownerElement; + + assertNull("attrgetownerelement03",ownerElement); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.html new file mode 100644 index 0000000000..1a066e45b7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement04.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/level2/core/attrgetownerelement04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrgetownerelement04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docsLoaded += preload(docImpRef, "docImp", "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 = 'attrgetownerelement04'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute is attached to or + null if this attribute is not in use. + Import an attribute node to another document. If an Attr node is imported, its + ownerElement attribute should be set to null. Verify if the ownerElement has been set + to null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement +*/ +function attrgetownerelement04() { + var success; + if(checkInitialization(builder, "attrgetownerelement04") != null) return; + var doc; + var docImp; + var ownerElement; + var element; + var attr; + var attrImp; + var addresses; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docImp = load(docImpRef, "docImp", "staff"); + addresses = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = addresses.item(1); + assertNotNull("empAddressNotNull",element); +attr = element.getAttributeNodeNS("http://www.nist.gov","zone"); + attrImp = docImp.importNode(attr,true); + ownerElement = attrImp.ownerElement; + + assertNull("attrgetownerelement04",ownerElement); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.html b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.html new file mode 100644 index 0000000000..90de82b210 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_attrgetownerelement05.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/level2/core/attrgetownerelement05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['attrgetownerelement05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'attrgetownerelement05'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute is attached to + or null if this attribute is not in use. + + Retreive an element and its attributes. Then remove the element and check the name of + the ownerElement of attribute of the attribute "street". + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function attrgetownerelement05() { + var success; + if(checkInitialization(builder, "attrgetownerelement05") != null) return; + var doc; + var element; + var ownerElement; + var parentElement; + var elementList; + var ownerElementName; + var attr; + var removedChild; + var nodeMap; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(1); + parentElement = element.parentNode; + + nodeMap = element.attributes; + + removedChild = parentElement.removeChild(element); + attr = nodeMap.getNamedItemNS(nullNS,"street"); + ownerElement = attr.ownerElement; + + ownerElementName = ownerElement.nodeName; + + assertEquals("attrgetownerelement05","address",ownerElementName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.html new file mode 100644 index 0000000000..c5dacc9a77 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS01.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/level2/core/createAttributeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createAttributeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createAttributeNS01'; + + +/** +* + The "createAttributeNS(namespaceURI,qualifiedName)" method for a + Document should raise NAMESPACE_ERR DOMException + if qualifiedName is malformed. + + Invoke method createAttributeNS(namespaceURI,qualifiedName) on + the XMLNS Document with namespaceURI being "http://www.ecommerce.org/", + qualifiedName as "prefix::local". Method should raise + NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createAttributeNS01() { + var success; + if(checkInitialization(builder, "createAttributeNS01") != null) return; + var namespaceURI = "http://www.ecommerce.org/"; + var malformedName = "prefix::local"; + var doc; + var newAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI,malformedName); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("throw INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.html new file mode 100644 index 0000000000..2b87f0fc80 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS02.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/level2/core/createAttributeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createAttributeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createAttributeNS02'; + +/** +* + The "createAttributeNS(namespaceURI,qualifiedName)" method for a + Document should raise NAMESPACE_ERR DOMException + if qualifiedName has a prefix and namespaceURI is null. + + Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document + with namespaceURI being null and qualifiedName contains the prefix "person". + Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createAttributeNS02() { + var success; + if(checkInitialization(builder, "createAttributeNS02") != null) return; + var namespaceURI = null; + + var qualifiedName = "prefix:local"; + var doc; + var newAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.html new file mode 100644 index 0000000000..fc98d24905 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS03.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/level2/core/createAttributeNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createAttributeNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createAttributeNS03'; + + +/** +* + The "createAttributeNS(namespaceURI,qualifiedName)" method for a + Document should raise INVALID_CHARACTER_ERR DOMException + if qualifiedName contains an illegal character. + + Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document + with qualifiedName containing an illegal character from illegalChars[]. + Method should raise INVALID_CHARACTER_ERR DOMException for all + characters in illegalChars[]. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +*/ +function createAttributeNS03() { + var success; + if(checkInitialization(builder, "createAttributeNS03") != null) return; + var namespaceURI = "http://www.wedding.com/"; + var qualifiedName; + var doc; + var newAttr; + illegalQNames = new Array(); + illegalQNames[0] = "person:{"; + illegalQNames[1] = "person:}"; + illegalQNames[2] = "person:~"; + illegalQNames[3] = "person:'"; + illegalQNames[4] = "person:!"; + illegalQNames[5] = "person:@"; + illegalQNames[6] = "person:#"; + illegalQNames[7] = "person:$"; + illegalQNames[8] = "person:%"; + illegalQNames[9] = "person:^"; + illegalQNames[10] = "person:&"; + illegalQNames[11] = "person:*"; + illegalQNames[12] = "person:("; + illegalQNames[13] = "person:)"; + illegalQNames[14] = "person:+"; + illegalQNames[15] = "person:="; + illegalQNames[16] = "person:["; + illegalQNames[17] = "person:]"; + illegalQNames[18] = "person:\\"; + illegalQNames[19] = "person:/"; + illegalQNames[20] = "person:;"; + illegalQNames[21] = "person:`"; + illegalQNames[22] = "person:<"; + illegalQNames[23] = "person:>"; + illegalQNames[24] = "person:,"; + illegalQNames[25] = "person:a "; + illegalQNames[26] = "person:\""; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + for(var indexN65680 = 0;indexN65680 < illegalQNames.length; indexN65680++) { + qualifiedName = illegalQNames[indexN65680]; + + { + success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); + } + 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/level2/core/createAttributeNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.html new file mode 100644 index 0000000000..f9633ffe8d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS04.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/level2/core/createAttributeNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createAttributeNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createAttributeNS04'; + + +/** +* + The "createAttributeNS(namespaceURI,qualifiedName)" method for a + Document should raise NAMESPACE_ERR DOMException + if qualifiedName has the "xml" prefix and namespaceURI is different + from "http://www.w3.org/XML/1998/namespace". + + Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document + with qualifiedName being "xml:attr1 and namespaceURI equals + the string "http://www.w3.org/XML/1998/namespaces" (which differs from the required + string "http://www.w3.org/XML/1998/namespace"). + Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createAttributeNS04() { + var success; + if(checkInitialization(builder, "createAttributeNS04") != null) return; + var namespaceURI = "http://www.w3.org/XML/1998/namespaces"; + var qualifiedName = "xml:attr1"; + var doc; + var newAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html new file mode 100644 index 0000000000..bd997d2d61 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS05.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createAttributeNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createAttributeNS05'; + + +/** +* + The "createAttributeNS(namespaceURI,qualifiedName)" method for a + Document should return a new Attr object given that all parameters are + valid and correctly formed. + + Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with + parameters equal "http://www.ecommerce.org/" and "ecom:local" + respectively. Method should return a new Attr object whose name is "ecom:local". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1112119403 +*/ +function createAttributeNS05() { + var success; + if(checkInitialization(builder, "createAttributeNS05") != null) return; + var namespaceURI = "http://www.ecommerce.org/"; + var qualifiedName = "econm:local"; + var doc; + var newAttr; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); + attrName = newAttr.name; + + assertEquals("throw_Equals",qualifiedName,attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.html b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.html new file mode 100644 index 0000000000..54bb2618a3 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createAttributeNS06.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/level2/core/createAttributeNS06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createAttributeNS06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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 = 'createAttributeNS06'; + + +/** +* +Document.createAttributeNS with an empty qualified name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function createAttributeNS06() { + var success; + if(checkInitialization(builder, "createAttributeNS06") != null) return; + var namespaceURI = "http://www.example.com/"; + var qualifiedName; + var doc; + var newAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI,""); + } + 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/level2/core/createAttributeNS06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +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-level2-core/test_createDocument01.html b/dom/tests/mochitest/dom-level2-core/test_createDocument01.html new file mode 100644 index 0000000000..50911bd6a2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument01.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/level2/core/createDocument01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocument01'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should raise NAMESPACE_ERR DOMException + if parameter qualifiedName is malformed. + + Retrieve the DOMImplementation on the XMLNS Document. + Invoke method createDocument(namespaceURI,qualifiedName,doctype) + on the retrieved DOMImplementation with namespaceURI being + the literal string "http://www.ecommerce.org/", qualifiedName as + "prefix::local", and doctype as null. Method should raise + NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createDocument01() { + var success; + if(checkInitialization(builder, "createDocument01") != null) return; + var namespaceURI = "http://www.ecommerce.org/"; + var malformedName = "prefix::local"; + var doc; + var docType = null; + + var domImpl; + var aNewDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,malformedName,docType); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("throw INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument02.html b/dom/tests/mochitest/dom-level2-core/test_createDocument02.html new file mode 100644 index 0000000000..c19940868b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument02.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/level2/core/createDocument02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocument02'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should raise NAMESPACE_ERR DOMException + if qualifiedName has a prefix and namespaceURI is null. + + Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + this domimplementation with namespaceURI being null and qualifiedName + equals "k:local". Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createDocument02() { + var success; + if(checkInitialization(builder, "createDocument02") != null) return; + var namespaceURI = null; + + var qualifiedName = "k:local"; + var doc; + var docType = null; + + var domImpl; + var aNewDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument03.html b/dom/tests/mochitest/dom-level2-core/test_createDocument03.html new file mode 100644 index 0000000000..a6ac5615b7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument03.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/level2/core/createDocument03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocument03'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException + if parameter doctype has been used with a different document. + + The specification has changed! No exception should be thrown. + + Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + this domimplementation where doctype is the type of this document. + Method should raise WRONG_DOCUMENT_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +*/ +function createDocument03() { + var success; + if(checkInitialization(builder, "createDocument03") != null) return; + var namespaceURI = "http://www.ecommerce.org/schema"; + var qualifiedName = "namespaceURI:x"; + var doc; + var docType; + var domImpl; + var aNewDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + domImpl = doc.implementation; + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + success = true; + } + catch(ex) { + success = false; + } + //assertTrue("no_throw_WRONG_DOCUMENT_ERR",success); + // Ensure at least one SimpleTest check is reported. (Bug 483992) + ok(success, "createDocument() succeeded"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument04.html b/dom/tests/mochitest/dom-level2-core/test_createDocument04.html new file mode 100644 index 0000000000..65872ae7f5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument04.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/level2/core/createDocument04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'createDocument04'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException + if parameter doctype was created from a different implementation. + + The specification has changed! No exception should be thrown. + + Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + a domimplementation that is different from this domimplementation. + Doctype is the type of this document. + Method should raise WRONG_DOCUMENT_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +*/ +function createDocument04() { + var success; + if(checkInitialization(builder, "createDocument04") != null) return; + var namespaceURI = "http://www.ecommerce.org/schema"; + var qualifiedName = "namespaceURI:x"; + var doc; + var docType; + var domImpl; + var aNewDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + docType = doc.doctype; + + domImpl = aNewDoc.implementation; + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + success = true; + } + catch(ex) { + success = false; + } + assertTrue("no_throw_WRONG_DOCUMENT_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument05.html b/dom/tests/mochitest/dom-level2-core/test_createDocument05.html new file mode 100644 index 0000000000..98ab5c9e94 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument05.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/level2/core/createDocument05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocument05'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should raise INVALID_CHARACTER_ERR DOMException + if parameter qualifiedName contains an illegal character. + + Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + this domimplementation with namespaceURI equals "http://www.ecommerce.org/schema", + doctype is null and qualifiedName contains an illegal character from + illegalChars[]. Method should raise INVALID_CHARACTER_ERR DOMException + for all characters in illegalChars[]. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core# +*/ +function createDocument05() { + var success; + if(checkInitialization(builder, "createDocument05") != null) return; + var namespaceURI = "http://www.ecommerce.org/schema"; + var qualifiedName; + var doc; + var docType = null; + + var domImpl; + var aNewDoc; + var charact; + illegalQNames = new Array(); + illegalQNames[0] = "namespaceURI:{"; + illegalQNames[1] = "namespaceURI:}"; + illegalQNames[2] = "namespaceURI:~"; + illegalQNames[3] = "namespaceURI:'"; + illegalQNames[4] = "namespaceURI:!"; + illegalQNames[5] = "namespaceURI:@"; + illegalQNames[6] = "namespaceURI:#"; + illegalQNames[7] = "namespaceURI:$"; + illegalQNames[8] = "namespaceURI:%"; + illegalQNames[9] = "namespaceURI:^"; + illegalQNames[10] = "namespaceURI:&"; + illegalQNames[11] = "namespaceURI:*"; + illegalQNames[12] = "namespaceURI:("; + illegalQNames[13] = "namespaceURI:)"; + illegalQNames[14] = "namespaceURI:+"; + illegalQNames[15] = "namespaceURI:="; + illegalQNames[16] = "namespaceURI:["; + illegalQNames[17] = "namespaceURI:]"; + illegalQNames[18] = "namespaceURI:\\"; + illegalQNames[19] = "namespaceURI:/"; + illegalQNames[20] = "namespaceURI:;"; + illegalQNames[21] = "namespaceURI:`"; + illegalQNames[22] = "namespaceURI:<"; + illegalQNames[23] = "namespaceURI:>"; + illegalQNames[24] = "namespaceURI:,"; + illegalQNames[25] = "namespaceURI:a "; + illegalQNames[26] = "namespaceURI:\""; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + for(var indexN65690 = 0;indexN65690 < illegalQNames.length; indexN65690++) { + qualifiedName = illegalQNames[indexN65690]; + domImpl = doc.implementation; + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + } + 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/level2/core/createDocument05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument06.html b/dom/tests/mochitest/dom-level2-core/test_createDocument06.html new file mode 100644 index 0000000000..a1894f44be --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument06.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/level2/core/createDocument06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocument06'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should raise NAMESPACE_ERR DOMException + if qualifiedName has the "xml" prefix and namespaceURI different from + "http://www.w3.org/XML/1998/namespace" + + Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + this domimplementation with qualifiedName "xml:local" + and namespaceURI as the string + "http://www.ecommerce.org/schema" (which is different from the required + "http://www.w3.org/XML/1998/namespace"). Method should raise + NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createDocument06() { + var success; + if(checkInitialization(builder, "createDocument06") != null) return; + var namespaceURI = "http://ecommerce.org/schema"; + var qualifiedName = "xml:local"; + var doc; + var docType = null; + + var domImpl; + var aNewDoc; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocument07.html b/dom/tests/mochitest/dom-level2-core/test_createDocument07.html new file mode 100644 index 0000000000..24446b0bf5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocument07.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/level2/core/createDocument07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocument07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocument07'; + + +/** +* + The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + DOMImplementation should return a new xml Document object of the + specified type with its document element given that all parameters are + valid and correctly formed. + + Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + this domimplementation. namespaceURI is "http://www.ecommerce.org/schema" + qualifiedName is "y:x" and doctype is null. + Method should return a new xml Document as specified by the listed parameters. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +*/ +function createDocument07() { + var success; + if(checkInitialization(builder, "createDocument07") != null) return; + var namespaceURI = "http://www.ecommerce.org/schema"; + var qualifiedName = "y:x"; + var doc; + var docType = null; + + var domImpl; + var aNewDoc; + var nodeName; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + nodeName = aNewDoc.nodeName; + + nodeValue = aNewDoc.nodeValue; + + assertEquals("nodeName","#document",nodeName); + assertNull("nodeValue",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html b/dom/tests/mochitest/dom-level2-core/test_createDocumentType01.html new file mode 100644 index 0000000000..2abaf16b70 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocumentType01.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/level2/core/createDocumentType01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocumentType01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocumentType01'; + + +/** +* + The "createDocumentType(qualifiedName,publicId,systemId)" method for a + DOMImplementation should raise NAMESPACE_ERR DOMException if + qualifiedName is malformed. + + Retrieve the DOMImplementation on the XMLNS Document. + Invoke method createDocumentType(qualifiedName,publicId,systemId) + on the retrieved DOMImplementation with qualifiedName being the literal + string "prefix::local", publicId as "STAFF", and systemId as "staff". + Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createDocumentType01() { + var success; + if(checkInitialization(builder, "createDocumentType01") != null) return; + var publicId = "STAFF"; + var systemId = "staff.xml"; + var malformedName = "prefix::local"; + var doc; + var domImpl; + var newType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + newType = domImpl.createDocumentType(malformedName,publicId,systemId); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("throw INVALID_CHARACTER_ERR", success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocumentType02.html b/dom/tests/mochitest/dom-level2-core/test_createDocumentType02.html new file mode 100644 index 0000000000..cd0756fc41 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocumentType02.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/level2/core/createDocumentType02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocumentType02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocumentType02'; + + +/** +* + The "createDocumentType(qualifiedName,publicId,systemId)" method for a + DOMImplementation should raise INVALID_CHARACTER_ERR DOMException if + qualifiedName contains an illegal character. + + Invoke method createDocumentType(qualifiedName,publicId,systemId) on + this domimplementation with qualifiedName containing an illegal character + from illegalChars[]. Method should raise INVALID_CHARACTER_ERR + DOMException for all characters in illegalChars[]. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +*/ +function createDocumentType02() { + var success; + if(checkInitialization(builder, "createDocumentType02") != null) return; + var publicId = "http://www.localhost.com/"; + var systemId = "myDoc.dtd"; + var qualifiedName; + var doc; + var docType = null; + + var domImpl; + illegalQNames = new Array(); + illegalQNames[0] = "edi:{"; + illegalQNames[1] = "edi:}"; + illegalQNames[2] = "edi:~"; + illegalQNames[3] = "edi:'"; + illegalQNames[4] = "edi:!"; + illegalQNames[5] = "edi:@"; + illegalQNames[6] = "edi:#"; + illegalQNames[7] = "edi:$"; + illegalQNames[8] = "edi:%"; + illegalQNames[9] = "edi:^"; + illegalQNames[10] = "edi:&"; + illegalQNames[11] = "edi:*"; + illegalQNames[12] = "edi:("; + illegalQNames[13] = "edi:)"; + illegalQNames[14] = "edi:+"; + illegalQNames[15] = "edi:="; + illegalQNames[16] = "edi:["; + illegalQNames[17] = "edi:]"; + illegalQNames[18] = "edi:\\"; + illegalQNames[19] = "edi:/"; + illegalQNames[20] = "edi:;"; + illegalQNames[21] = "edi:`"; + illegalQNames[22] = "edi:<"; + illegalQNames[23] = "edi:>"; + illegalQNames[24] = "edi:,"; + illegalQNames[25] = "edi:a "; + illegalQNames[26] = "edi:\""; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + for(var indexN65690 = 0;indexN65690 < illegalQNames.length; indexN65690++) { + qualifiedName = illegalQNames[indexN65690]; + domImpl = doc.implementation; + + { + success = false; + try { + docType = domImpl.createDocumentType(qualifiedName,publicId,systemId); + } + 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/level2/core/createDocumentType02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createDocumentType03.html b/dom/tests/mochitest/dom-level2-core/test_createDocumentType03.html new file mode 100644 index 0000000000..a71656c754 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createDocumentType03.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/level2/core/createDocumentType03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createDocumentType03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createDocumentType03'; + + +/** +* + The "createDocumentType(qualifiedName,publicId,systemId)" method for a + DOMImplementation should return a new DocumentType node + given that qualifiedName is valid and correctly formed. + + Invoke method createDocumentType(qualifiedName,publicId,systemId) on + this domimplementation with qualifiedName "prefix:myDoc". + Method should return a new DocumentType node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType +*/ +function createDocumentType03() { + var success; + if(checkInitialization(builder, "createDocumentType03") != null) return; + var namespaceURI = "http://ecommerce.org/schema"; + var qualifiedName = "prefix:myDoc"; + var publicId = "http://www.localhost.com"; + var systemId = "myDoc.dtd"; + var doc; + var domImpl; + var newType = null; + + var nodeName; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newType = domImpl.createDocumentType(qualifiedName,publicId,systemId); + nodeName = newType.nodeName; + + assertEquals("nodeName","prefix:myDoc",nodeName); + nodeValue = newType.nodeValue; + + assertNull("nodeValue",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS01.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS01.html new file mode 100644 index 0000000000..41e5caa052 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS01.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/level2/core/createElementNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createElementNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createElementNS01'; + + +/** +* + The "createElementNS(namespaceURI,qualifiedName)" method for a + Document should raise NAMESPACE_ERR DOMException if + qualifiedName is malformed. + + Invoke method createElementNS(namespaceURI,qualifiedName) on + the XMLNS Document with namespaceURI being the literal string + "http://www.ecommerce.org/", and qualifiedName as "prefix::local". + Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createElementNS01() { + var success; + if(checkInitialization(builder, "createElementNS01") != null) return; + var namespaceURI = "http://www.ecommerce.org/"; + var malformedName = "prefix::local"; + var doc; + var newElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + newElement = doc.createElementNS(namespaceURI,malformedName); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("throw INVALID_CHARACTER_ERR", success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS02.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS02.html new file mode 100644 index 0000000000..3b49ff9ac2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS02.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/level2/core/createElementNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createElementNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createElementNS02'; + + +/** +* + The "createElementNS(namespaceURI,qualifiedName)" method for a + Document should raise NAMESPACE_ERR DOMException if + qualifiedName has a prefix and namespaceURI is null. + + Invoke method createElementNS(namespaceURI,qualifiedName) on this document + with namespaceURI being null and qualifiedName being "elem:attr1". + Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createElementNS02() { + var success; + if(checkInitialization(builder, "createElementNS02") != null) return; + var namespaceURI = null; + + var qualifiedName = "prefix:local"; + var doc; + var newElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + newElement = doc.createElementNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS03.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS03.html new file mode 100644 index 0000000000..dd71c2f7fe --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS03.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/level2/core/createElementNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createElementNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createElementNS03'; + + +/** +* + The "createElementNS(namespaceURI,qualifiedName)" method for a + Document should raise INVALID_CHARACTER_ERR DOMException if + qualifiedName contains an illegal character. + + Invoke method createElementNS(namespaceURI,qualifiedName) on this document + with qualifiedName containing an illegal character from illegalChars[]. + Method should raise INVALID_CHARACTER_ERR DOMException for all characters + in illegalChars[]. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +*/ +function createElementNS03() { + var success; + if(checkInitialization(builder, "createElementNS03") != null) return; + var namespaceURI = "http://www.wedding.com/"; + var qualifiedName; + var doc; + var done; + var newElement; + var charact; + illegalQNames = new Array(); + illegalQNames[0] = "person:{"; + illegalQNames[1] = "person:}"; + illegalQNames[2] = "person:~"; + illegalQNames[3] = "person:'"; + illegalQNames[4] = "person:!"; + illegalQNames[5] = "person:@"; + illegalQNames[6] = "person:#"; + illegalQNames[7] = "person:$"; + illegalQNames[8] = "person:%"; + illegalQNames[9] = "person:^"; + illegalQNames[10] = "person:&"; + illegalQNames[11] = "person:*"; + illegalQNames[12] = "person:("; + illegalQNames[13] = "person:)"; + illegalQNames[14] = "person:+"; + illegalQNames[15] = "person:="; + illegalQNames[16] = "person:["; + illegalQNames[17] = "person:]"; + illegalQNames[18] = "person:\\"; + illegalQNames[19] = "person:/"; + illegalQNames[20] = "person:;"; + illegalQNames[21] = "person:`"; + illegalQNames[22] = "person:<"; + illegalQNames[23] = "person:>"; + illegalQNames[24] = "person:,"; + illegalQNames[25] = "person:a "; + illegalQNames[26] = "person:\""; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + for(var indexN65688 = 0;indexN65688 < illegalQNames.length; indexN65688++) { + qualifiedName = illegalQNames[indexN65688]; + + { + success = false; + try { + newElement = doc.createElementNS(namespaceURI,qualifiedName); + } + 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/level2/core/createElementNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS04.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS04.html new file mode 100644 index 0000000000..e70723aeba --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS04.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/level2/core/createElementNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createElementNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createElementNS04'; + + +/** +* + The "createElementNS(namespaceURI,qualifiedName") method for + a Document should raise NAMESPACE_ERR DOMException if the + qualifiedName has an "xml" prefix and the namespaceURI is different + from http://www.w3.org/XML/1998/namespace". + + Invoke method createElementNS(namespaceURI,qualifiedName) on this document + with qualifiedName being "xml:element1" and namespaceURI equals the string + "http://www.w3.org/XML/1997/namespace" (which differs from the required + string "http://www.w3.org/XML/1998/namespace"). + Method should raise NAMESPACE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function createElementNS04() { + var success; + if(checkInitialization(builder, "createElementNS04") != null) return; + var namespaceURI = "http://www.w3.org/XML/1998/namespaces"; + var qualifiedName = "xml:element1"; + var doc; + var newElement; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + newElement = doc.createElementNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS05.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS05.html new file mode 100644 index 0000000000..5ade12f66f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS05.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createElementNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'createElementNS05'; + + +/** +* + The "createElementNS(namespaceURI,qualifiedName)" method for a + Document should return a new Element object given that all parameters + are valid and correctly formed. + + Invoke method createElementNS(namespaceURI,qualifiedName on this document + with namespaceURI as "http://www.nist.gov" and qualifiedName as "gov:faculty". + Method should return a new Element object whose name is "gov:faculty". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815 +*/ +function createElementNS05() { + var success; + if(checkInitialization(builder, "createElementNS05") != null) return; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "gov:faculty"; + var doc; + var newElement; + var elementName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + newElement = doc.createElementNS(namespaceURI,qualifiedName); + elementName = newElement.tagName; + + assertEquals("throw_Equals",qualifiedName,elementName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/createElementNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_createElementNS06.html b/dom/tests/mochitest/dom-level2-core/test_createElementNS06.html new file mode 100644 index 0000000000..c4bae45769 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_createElementNS06.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/level2/core/createElementNS06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['createElementNS06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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 = 'createElementNS06'; + + +/** +* +Document.createElementNS with an empty qualified name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function createElementNS06() { + var success; + if(checkInitialization(builder, "createElementNS06") != null) return; + var namespaceURI = "http://www.example.com/"; + var qualifiedName; + var doc; + var done; + var newElement; + var charact; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + newElement = doc.createElementNS(namespaceURI,""); + } + 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/level2/core/createElementNS06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +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-level2-core/test_documentcreateattributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS01.html new file mode 100644 index 0000000000..ac40eb1c79 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS01.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/level2/core/documentcreateattributeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS01'; + + +/** +* + The method createAttributeNS creates an attribute of the given qualified name and namespace URI + + Invoke the createAttributeNS method on this Document object with a null + namespaceURI, and a qualifiedName without a prefix. This should return a valid Attr + node object. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS01() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS01") != null) return; + var doc; + var attribute; + var namespaceURI = null; + + var qualifiedName = "test"; + var name; + var nodeName; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + attribute = doc.createAttributeNS(namespaceURI,qualifiedName); + nodeName = attribute.nodeName; + + nodeValue = attribute.nodeValue; + + assertEquals("documentcreateattributeNS01","test",nodeName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.html new file mode 100644 index 0000000000..1a6614debd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS02.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/level2/core/documentcreateattributeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS02'; + + +/** +* + The method createAttributeNS creates an attribute of the given qualified name and namespace URI + + Invoke the createAttributeNS method on this Document object with a valid values for + namespaceURI, and a qualifiedName as below. This should return a valid Attr node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS02() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS02") != null) return; + var doc; + var attribute1; + var attribute2; + var name; + var nodeName; + var nodeValue; + var prefix; + var namespaceURI; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + attribute1 = doc.createAttributeNS("http://www.w3.org/XML/1998/namespace","xml:xml"); + name = attribute1.name; + + nodeName = attribute1.nodeName; + + nodeValue = attribute1.nodeValue; + + prefix = attribute1.prefix; + + namespaceURI = attribute1.namespaceURI; + + assertEquals("documentcreateattributeNS02_att1_name","xml:xml",name); + assertEquals("documentcreateattributeNS02_att1_nodeName","xml:xml",nodeName); + assertEquals("documentcreateattributeNS02_att1_nodeValue","",nodeValue); + assertEquals("documentcreateattributeNS02_att1_prefix","xml",prefix); + assertEquals("documentcreateattributeNS02_att1_namespaceURI","http://www.w3.org/XML/1998/namespace",namespaceURI); + attribute2 = doc.createAttributeNS("http://www.w3.org/2000/xmlns/","xmlns"); + name = attribute2.name; + + nodeName = attribute2.nodeName; + + nodeValue = attribute2.nodeValue; + + prefix = attribute2.prefix; + + namespaceURI = attribute2.namespaceURI; + + assertEquals("documentcreateattributeNS02_att2_name","xmlns",name); + assertEquals("documentcreateattributeNS02_att2_nodeName","xmlns",nodeName); + assertEquals("documentcreateattributeNS02_att2_nodeValue","",nodeValue); + assertEquals("documentcreateattributeNS02_att2_namespaceURI","http://www.w3.org/2000/xmlns/",namespaceURI); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.html new file mode 100644 index 0000000000..b41f476ded --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS03.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/level2/core/documentcreateattributeNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS03'; + + +/** +* + The method createAttributeNS raises an INVALID_CHARACTER_ERR if the specified + qualified name contains an illegal character + + Invoke the createAttributeNS method on this Document object with a valid value for + namespaceURI, and qualifiedNames that contain illegal characters. Check if the an + INVALID_CHARACTER_ERR was thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS03() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS03") != null) return; + var doc; + var attribute; + var namespaceURI = "http://www.w3.org/DOM/Test/Level2"; + var qualifiedName; + qualifiedNames = new Array(); + qualifiedNames[0] = "/"; + qualifiedNames[1] = "//"; + qualifiedNames[2] = "\\"; + qualifiedNames[3] = ";"; + qualifiedNames[4] = "&"; + qualifiedNames[5] = "*"; + qualifiedNames[6] = "]]"; + qualifiedNames[7] = ">"; + qualifiedNames[8] = "<"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + for(var indexN65626 = 0;indexN65626 < qualifiedNames.length; indexN65626++) { + qualifiedName = qualifiedNames[indexN65626]; + + { + success = false; + try { + attribute = doc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("documentcreateattributeNS03",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.html new file mode 100644 index 0000000000..20466477a9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS04.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/level2/core/documentcreateattributeNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS04'; + + +/** +* + The method createAttributeNS raises a NAMESPACE_ERR if the specified qualified name + is malformed. + + Invoke the createAttributeNS method on this Document object with a valid value for + namespaceURI, and malformed qualifiedNames. Check if the a NAMESPACE_ERR was thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS04() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS04") != null) return; + var doc; + var attribute; + var namespaceURI = "http://www.w3.org/DOM/Test/Level2"; + var qualifiedName; + qualifiedNames = new Array(); + qualifiedNames[0] = "_:"; + qualifiedNames[1] = ":0a"; + qualifiedNames[2] = ":"; + qualifiedNames[3] = "a:b:c"; + qualifiedNames[4] = "_::a"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + for(var indexN65614 = 0;indexN65614 < qualifiedNames.length; indexN65614++) { + qualifiedName = qualifiedNames[indexN65614]; + + { + success = false; + try { + attribute = doc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("documentcreateattributeNS04",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.html new file mode 100644 index 0000000000..84f1a40a11 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS05.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/level2/core/documentcreateattributeNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS05'; + + +/** +* + The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName has a prefix and + the namespaceURI is null. + + Invoke the createAttributeNS method on a new Document object with a null value for + namespaceURI, and a valid qualifiedName. Check if a NAMESPACE_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS05() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS05") != null) return; + var doc; + var newDoc; + var docType = null; + + var domImpl; + var attribute; + var namespaceURI = null; + + var qualifiedName = "abc:def"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType); + + { + success = false; + try { + attribute = newDoc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("documentcreateattributeNS05",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.html new file mode 100644 index 0000000000..ecfeb4af6d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS06.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/level2/core/documentcreateattributeNS06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS06'; + + +/** +* + The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName has a prefix that + is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace". + + Invoke the createAttributeNS method on a new DOMImplementation object with the qualifiedName + as xml:root and namespaceURI as http://www.w3.org/XML/1998 /namespace. + Check if the NAMESPACE_ERR exception is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS06() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS06") != null) return; + var doc; + var newDoc; + var docType = null; + + var domImpl; + var attribute; + var namespaceURI = "http://www.w3.org/XML/1998 /namespace"; + var qualifiedName = "xml:root"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType); + + { + success = false; + try { + attribute = newDoc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("documentcreateattributeNS06",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.html new file mode 100644 index 0000000000..ae84931402 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateattributeNS07.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/level2/core/documentcreateattributeNS07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateattributeNS07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateattributeNS07'; + + +/** +* + The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName is xmlns and + the namespaceURI is different from http://www.w3.org/2000/xmlns + + Invoke the createAttributeNS method on this DOMImplementation object with + the qualifiedName as xmlns and namespaceURI as http://www.W3.org/2000/xmlns. + Check if the NAMESPACE_ERR exception is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS +*/ +function documentcreateattributeNS07() { + var success; + if(checkInitialization(builder, "documentcreateattributeNS07") != null) return; + var doc; + var attribute; + var namespaceURI = "http://www.W3.org/2000/xmlns"; + var qualifiedName = "xmlns"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + attribute = doc.createAttributeNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("documentcreateattributeNS07",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.html new file mode 100644 index 0000000000..49652dbaed --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS01.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/level2/core/documentcreateelementNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelementNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelementNS01'; + + +/** +* + The method createElementNS creates an element of the given valid qualifiedName and NamespaceURI. + + Invoke the createElementNS method on this Document object with a valid namespaceURI + and qualifiedName. Check if a valid Element object is returned with the same node attributes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +*/ +function documentcreateelementNS01() { + var success; + if(checkInitialization(builder, "documentcreateelementNS01") != null) return; + var doc; + var element; + var namespaceURI = "http://www.w3.org/DOM/Test/level2"; + var qualifiedName = "XML:XML"; + var nodeName; + var nsURI; + var localName; + var prefix; + var tagName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS(namespaceURI,qualifiedName); + nodeName = element.nodeName; + + nsURI = element.namespaceURI; + + localName = element.localName; + + prefix = element.prefix; + + tagName = element.tagName; + + assertEquals("documentcreateelementNS01_nodeName","XML:XML",nodeName); + assertEquals("documentcreateelementNS01_namespaceURI","http://www.w3.org/DOM/Test/level2",nsURI); + assertEquals("documentcreateelementNS01_localName","XML",localName); + assertEquals("documentcreateelementNS01_prefix","XML",prefix); + assertEquals("documentcreateelementNS01_tagName","XML:XML",tagName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.html new file mode 100644 index 0000000000..fb5662242d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS02.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/level2/core/documentcreateelementNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelementNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelementNS02'; + + +/** +* + The method createElementNS creates an element of the given valid qualifiedName and NamespaceURI. + + Invoke the createElementNS method on this Document object with null values for namespaceURI, + and a qualifiedName with an invalid character and check if an INVALID_CHARACTER_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +*/ +function documentcreateelementNS02() { + var success; + if(checkInitialization(builder, "documentcreateelementNS02") != null) return; + var doc; + var element; + var namespaceURI = null; + + var qualifiedName = "^^"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + element = doc.createElementNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("documentcreateelementNS02",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.html new file mode 100644 index 0000000000..2ec363db20 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS05.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/level2/core/documentcreateelementNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelementNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelementNS05'; + + +/** +* + The method createElementNS raises a NAMESPACE_ERR if the qualifiedName has a prefix and + the namespaceURI is null. + + Invoke the createElementNS method on a new Document object with a null value for + namespaceURI, and a valid qualifiedName. Check if a NAMESPACE_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +*/ +function documentcreateelementNS05() { + var success; + if(checkInitialization(builder, "documentcreateelementNS05") != null) return; + var doc; + var element; + var namespaceURI = null; + + var qualifiedName = "null:xml"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + element = doc.createElementNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("documentcreateelementNS05",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.html b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.html new file mode 100644 index 0000000000..6c2f0ce8c9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentcreateelementNS06.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/level2/core/documentcreateelementNS06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentcreateelementNS06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentcreateelementNS06'; + + +/** +* + The method createElementNS raises a NAMESPACE_ERR if the qualifiedName + has a prefix that is "xml" and the namespaceURI is different + from http://www.w3.org/XML/1998/namespace + + Invoke the createElementNS method on this DOMImplementation object with + the qualifiedName as xml:root and namespaceURI as http://www.w3.org/xml/1998/namespace + Check if the NAMESPACE_ERR exception is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS +*/ +function documentcreateelementNS06() { + var success; + if(checkInitialization(builder, "documentcreateelementNS06") != null) return; + var doc; + var newDoc; + var docType = null; + + var domImpl; + var element; + var namespaceURI = "http://www.w3.org/xml/1998/namespace "; + var qualifiedName = "xml:root"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType); + + { + success = false; + try { + element = newDoc.createElementNS(namespaceURI,qualifiedName); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("documentcreateelementNS06",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateelementNS06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html new file mode 100644 index 0000000000..0b6c29e9af --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementbyid01.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementbyid01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementbyid01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementbyid01'; + + +/** +* + The method getElementById returns the element whose ID is given by elementId. + If not such element exists, returns null. + + Invoke the getElementById method on this Document object with an invalid elementId. + This should return a null element. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId +*/ +function documentgetelementbyid01() { + var success; + if(checkInitialization(builder, "documentgetelementbyid01") != null) return; + var doc; + var element; + var elementId = "---"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.getElementById(elementId); + assertNull("documentgetelementbyid01",element); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementbyid01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.html new file mode 100644 index 0000000000..54b7fb99ab --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS01.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/level2/core/documentgetelementsbytagnameNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnameNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnameNS01'; + + +/** +* + The method getElementsByTagNameNS returns a NodeList of all the Elements with + a given local name and namespace URI in the order in which they are encountered + in a preorder traversal of the Document tree. + + Invoke the getElementsByTagNameNS method on a new Document object with the values of + namespaceURI=* and localName=*. This should return a nodeList of 1 item. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function documentgetelementsbytagnameNS01() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnameNS01") != null) return; + var doc; + var newDoc; + var docType = null; + + var domImpl; + var childList; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument(nullNS,"root",docType); + childList = newDoc.getElementsByTagNameNS("*","*"); + assertSize("documentgetelementsbytagnameNS01",1,childList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.html new file mode 100644 index 0000000000..50d3e8dc06 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS02.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/level2/core/documentgetelementsbytagnameNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnameNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnameNS02'; + + +/** +* + The method getElementsByTagNameNS returns a NodeList of all the Elements with + a given local name and namespace URI in the order in which they are encountered + in a preorder traversal of the Document tree. + + + Create a new element having a local name="employeeId" belonging to the namespace "test" + and append it to this document. Invoke the getElementsByTagNameNS method on a this + Document object with the values of namespaceURI=* and localName="elementId". This + should return a nodeList of 6 item. Check the length of the nodeList returned. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function documentgetelementsbytagnameNS02() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnameNS02") != null) return; + var doc; + var docElem; + var element; + var childList; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + element = doc.createElementNS("test","employeeId"); + appendedChild = docElem.appendChild(element); + childList = doc.getElementsByTagNameNS("*","employeeId"); + assertSize("documentgetelementsbytagnameNS02",6,childList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html new file mode 100644 index 0000000000..ae45fac214 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS03.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnameNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnameNS03'; + + +/** +* + The method getElementsByTagNameNS returns a NodeList of all the Elements with + a given local name and namespace URI in the order in which they are encountered + in a preorder traversal of the Document tree. + + Invoke the getElementsByTagNameNS method on a new Document object with the values of + namespaceURI=** and localName=**. This should return a nodeList of 0 items. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function documentgetelementsbytagnameNS03() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnameNS03") != null) return; + var doc; + var childList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("**","*"); + assertSize("documentgetelementsbytagnameNS03",0,childList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.html new file mode 100644 index 0000000000..793c548413 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS04.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/level2/core/documentgetelementsbytagnameNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnameNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnameNS04'; + + +/** +* + The method getElementsByTagNameNS returns a NodeList of all the Elements with + a given local name and namespace URI in the order in which they are encountered + in a preorder traversal of the Document tree. + + Invoke the getElementsByTagNameNS method on a new Document object with the values of + namespaceURI="null" and localName="0". This should return a nodeList of 0 items. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function documentgetelementsbytagnameNS04() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnameNS04") != null) return; + var doc; + var childList; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS(nullNS,"0"); + assertSize("documentgetelementsbytagnameNS04",0,childList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html new file mode 100644 index 0000000000..cb6e93b6fb --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentgetelementsbytagnameNS05.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentgetelementsbytagnameNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentgetelementsbytagnameNS05'; + + +/** +* + The method getElementsByTagNameNS returns a NodeList of all the Elements with + a given local name and namespace URI in the order in which they are encountered + in a preorder traversal of the Document tree. + + + Invoke the getElementsByTagNameNS method on a this Document object with the + values of namespaceURI=null and localName="elementId". This + should return a nodeList of 0 item. Check the length of the nodeList returned. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function documentgetelementsbytagnameNS05() { + var success; + if(checkInitialization(builder, "documentgetelementsbytagnameNS05") != null) return; + var doc; + var childList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("null","elementId"); + assertSize("documentgetelementsbytagnameNS05",0,childList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode01.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode01.html new file mode 100644 index 0000000000..c73e615041 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode01.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/level2/core/documentimportnode01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode01'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import the attribute, "street" of the second + element node, from a list of nodes whose local names are "address" and namespaceURI + "http://www.nist.gov" into the same document. Check the parentNode, nodeName, + nodeType and nodeValue of the imported node to verify if it has been imported correctly. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode01() { + var success; + if(checkInitialization(builder, "documentimportnode01") != null) return; + var doc; + var element; + var attr; + var childList; + var importedAttr; + var nodeName; + var nodeType; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = childList.item(1); + attr = element.getAttributeNode("street"); + importedAttr = doc.importNode(attr,false); + nodeName = importedAttr.nodeName; + + nodeValue = importedAttr.nodeValue; + + nodeType = importedAttr.nodeType; + + assertEquals("documentimportnode01_nodeName","street",nodeName); + assertEquals("documentimportnode01_nodeType",2,nodeType); + assertEquals("documentimportnode01_nodeValue","Yes",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode02.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode02.html new file mode 100644 index 0000000000..325165da75 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode02.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/level2/core/documentimportnode02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docImportedRef = null; + if (typeof(this.docImported) != 'undefined') { + docImportedRef = this.docImported; + } + docsLoaded += preload(docImportedRef, "docImported", "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 = 'documentimportnode02'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import the attribute, "emp:zone" of the + element node which is retreived by its elementId="CANADA", into the another document. + Check the parentNode, nodeName, nodeType and nodeValue of the imported node to + verify if it has been imported correctly. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode02() { + var success; + if(checkInitialization(builder, "documentimportnode02") != null) return; + var doc; + var docImported; + var element; + var attr; + var importedAttr; + var nodeName; + var nodeType; + var nodeValue; + var addresses; + var attrsParent; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docImportedRef = null; + if (typeof(this.docImported) != 'undefined') { + docImportedRef = this.docImported; + } + docImported = load(docImportedRef, "docImported", "staff"); + addresses = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = addresses.item(1); + attr = element.getAttributeNodeNS("http://www.nist.gov","zone"); + importedAttr = docImported.importNode(attr,false); + nodeName = importedAttr.nodeName; + + nodeType = importedAttr.nodeType; + + nodeValue = importedAttr.nodeValue; + + attrsParent = importedAttr.parentNode; + + assertNull("documentimportnode02_parentNull",attrsParent); + assertEquals("documentimportnode02_nodeName","emp:zone",nodeName); + assertEquals("documentimportnode02_nodeType",2,nodeType); + assertEquals("documentimportnode02_nodeValue","CANADA",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html new file mode 100644 index 0000000000..c325c07178 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode03.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/level2/core/documentimportnode03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode03'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import the default Attribute attribute, + "defaultAttr" of the second element node whose namespaceURI="http://www.nist.gov" and + localName="defaultAttr", into the same document. + Check the parentNode, nodeName, nodeType and nodeValue of the imported node to + verify if it has been imported correctly. +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode03() { + var success; + if(checkInitialization(builder, "documentimportnode03") != null) return; + var doc; + var element; + var attr; + var childList; + var importedAttr; + var nodeName; + var nodeType; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = childList.item(1); + attr = element.getAttributeNode("defaultAttr"); + importedAttr = doc.importNode(attr,false); + nodeName = importedAttr.nodeName; + + nodeValue = importedAttr.nodeValue; + + nodeType = importedAttr.nodeType; + + assertEquals("documentimportnode03_nodeName","defaultAttr",nodeName); + assertEquals("documentimportnode03_nodeType",2,nodeType); + assertEquals("documentimportnode03_nodeValue","defaultVal",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html new file mode 100644 index 0000000000..174eece4b7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode04.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/level2/core/documentimportnode04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode04'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import the default Attribute attribute, + "defaultAttr" of the second element node whose namespaceURI="http://www.nist.gov" and + localName="defaultAttr", into a new document. + Check the parentNode, nodeName, nodeType and nodeValue of the imported node to + verify if it has been imported correctly. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode04() { + var success; + if(checkInitialization(builder, "documentimportnode04") != null) return; + var doc; + var newDoc; + var docType = null; + + var domImpl; + var element; + var attr; + var childList; + var importedAttr; + var nodeName; + var nodeType; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","l2:root",docType); + childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = childList.item(1); + attr = element.getAttributeNode("defaultAttr"); + importedAttr = newDoc.importNode(attr,true); + nodeName = importedAttr.nodeName; + + nodeValue = importedAttr.nodeValue; + + nodeType = importedAttr.nodeType; + + assertEquals("documentimportnode04_nodeName","defaultAttr",nodeName); + assertEquals("documentimportnode04_nodeType",2,nodeType); + assertEquals("documentimportnode04_nodeValue","defaultVal",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode05.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode05.html new file mode 100644 index 0000000000..dac651c0fa --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode05.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/level2/core/documentimportnode05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docImportedRef = null; + if (typeof(this.docImported) != 'undefined') { + docImportedRef = this.docImported; + } + docsLoaded += preload(docImportedRef, "docImported", "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 = 'documentimportnode05'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import a newly created attribute node, + into the another document. + Check the nodeName, nodeType and nodeValue namespaceURI of the imported node to + verify if it has been imported correctly. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode05() { + var success; + if(checkInitialization(builder, "documentimportnode05") != null) return; + var doc; + var docImported; + var attr; + var importedAttr; + var nodeName; + var nodeType; + var nodeValue; + var namespaceURI; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docImportedRef = null; + if (typeof(this.docImported) != 'undefined') { + docImportedRef = this.docImported; + } + docImported = load(docImportedRef, "docImported", "staff"); + attr = doc.createAttributeNS("http://www.w3.org/DOM/Test","a_:b0"); + importedAttr = docImported.importNode(attr,false); + nodeName = importedAttr.nodeName; + + nodeValue = importedAttr.nodeValue; + + nodeType = importedAttr.nodeType; + + namespaceURI = importedAttr.namespaceURI; + + assertEquals("documentimportnode05_nodeName","a_:b0",nodeName); + assertEquals("documentimportnode05_nodeType",2,nodeType); + assertEquals("documentimportnode05_nodeValue","",nodeValue); + assertEquals("documentimportnode05_namespaceURI","http://www.w3.org/DOM/Test",namespaceURI); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode06.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode06.html new file mode 100644 index 0000000000..2eb79f2c93 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode06.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/level2/core/documentimportnode06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode06'; + + +/** +* + The importNode method imports a node from another document to this document. + A NOT_SUPPORTED_ERR is raised if the type of node being imported is + not supported + + Using the method importNode with deep=false, try to import this document object to itself. + Since Document nodes cannot be imported, a NOT_SUPPORTED_ERR should be raised. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode06() { + var success; + if(checkInitialization(builder, "documentimportnode06") != null) return; + var doc; + var docImported; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + { + success = false; + try { + docImported = doc.importNode(doc,false); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode07.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode07.html new file mode 100644 index 0000000000..18d31146dc --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode07.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/level2/core/documentimportnode07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode07'; + + +/** +* + The importNode method imports a node from another document to this document. + A NOT_SUPPORTED_ERR is raised if the type of node being imported is + not supported + + Using the method importNode with deep=true, try to import this Document's + DocumentType object. Since DocumentType nodes cannot be imported, a + NOT_SUPPORTED_ERR should be raised. + + The specification has changed! No exception should be thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode07() { + var success; + if(checkInitialization(builder, "documentimportnode07") != null) return; + var doc; + var imported; + var docType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + + { + success = false; + try { + imported = doc.importNode(docType,true); + success = true; + } + catch(ex) { + success = false; + } + assertTrue("no_throw_NOT_SUPPORTED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode08.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode08.html new file mode 100644 index 0000000000..062e18842c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode08.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/level2/core/documentimportnode08</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode08'; + + +/** +* + The importNode method imports a node from another document to this document. + A NOT_SUPPORTED_ERR is raised if the type of node being imported is + not supported + + Using the method importNode with deep=true, try to import a newly created DOcumentType + node. Since DocumentType nodes cannot be imported, a NOT_SUPPORTED_ERR should be raised. + + The specification has changed! No exception should be thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function documentimportnode08() { + var success; + if(checkInitialization(builder, "documentimportnode08") != null) return; + var doc; + var imported; + var docType; + var domImpl; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docType = domImpl.createDocumentType("test:root",nullNS,nullNS); + + { + success = false; + try { + imported = doc.importNode(docType,true); + success = true; + } + catch(ex) { + success = false; + } + assertTrue("no_throw_NOT_SUPPORTED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode09.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode09.html new file mode 100644 index 0000000000..d7c2d4eabb --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode09.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/level2/core/documentimportnode09</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode09'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import a newly created DocumentFragment node + with the first address element from this Document appended to it into this document. + Since deep=false, an empty DocumentFragment should be returned + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode09() { + var success; + if(checkInitialization(builder, "documentimportnode09") != null) return; + var doc; + var docFragment; + var childList; + var success; + var addressNode; + var appendedChild; + var importedDocFrag; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docFragment = doc.createDocumentFragment(); + childList = doc.getElementsByTagNameNS("*","address"); + addressNode = childList.item(0); + appendedChild = docFragment.appendChild(addressNode); + importedDocFrag = doc.importNode(docFragment,false); + success = importedDocFrag.hasChildNodes(); + assertFalse("documentimportnode09",success); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode10.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode10.html new file mode 100644 index 0000000000..85c2e975d6 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode10.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/level2/core/documentimportnode10</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode10']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode10'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import a newly created DocumentFragment node + with the first address element from this Document appended to it into this document. + Since deep=true, a DocumentFragment with its child should be returned + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode10() { + var success; + if(checkInitialization(builder, "documentimportnode10") != null) return; + var doc; + var docFragment; + var childList; + var success; + var addressNode; + var appendedChild; + var importedDocFrag; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docFragment = doc.createDocumentFragment(); + childList = doc.getElementsByTagNameNS("*","address"); + addressNode = childList.item(0); + appendedChild = docFragment.appendChild(addressNode); + importedDocFrag = doc.importNode(docFragment,true); + success = importedDocFrag.hasChildNodes(); + assertTrue("documentimportnode10",success); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode10</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode11.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode11.html new file mode 100644 index 0000000000..0a695fdde9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode11.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/level2/core/documentimportnode11</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode11']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode11'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import this Document's documentElement + node. Verify if the node has been imported correctly by its nodeName atttribute and + if the original document is not altered by checking if hasChildNodes returns false. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode11() { + var success; + if(checkInitialization(builder, "documentimportnode11") != null) return; + var doc; + var docElement; + var imported; + var success; + var nodeNameOrig; + var nodeNameImported; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElement = doc.documentElement; + + imported = doc.importNode(docElement,false); + success = imported.hasChildNodes(); + assertFalse("documentimportnode11",success); +nodeNameImported = imported.nodeName; + + nodeNameOrig = docElement.nodeName; + + assertEquals("documentimportnode11_NodeName",nodeNameImported,nodeNameOrig); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode11</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode12.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode12.html new file mode 100644 index 0000000000..af3bfecce9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode12.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/level2/core/documentimportnode12</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode12']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode12'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import the first address element node of this + Document. Verify if the node has been imported correctly by checking the length of the + this elements childNode list before and after the import. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode12() { + var success; + if(checkInitialization(builder, "documentimportnode12") != null) return; + var doc; + var childList; + var imported; + var addressElem; + var addressElemChildren; + var importedChildren; + var addressElemLen; + var importedLen; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("*","address"); + addressElem = childList.item(0); + imported = doc.importNode(addressElem,true); + addressElemChildren = addressElem.childNodes; + + importedChildren = imported.childNodes; + + addressElemLen = addressElemChildren.length; + + importedLen = importedChildren.length; + + assertEquals("documentimportnode12",importedLen,addressElemLen); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode12</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode13.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode13.html new file mode 100644 index 0000000000..15a0c6bee5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode13.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/level2/core/documentimportnode13</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode13']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode13'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=false, import the first employee element node of this + Document. Verify if the node has been imported correctly by checking the length of the + this elements childNode list before and after the import. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode13() { + var success; + if(checkInitialization(builder, "documentimportnode13") != null) return; + var doc; + var childList; + var imported; + var importedList; + var employeeElem; + var importedLen; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("*","employee"); + employeeElem = childList.item(0); + imported = doc.importNode(employeeElem,false); + importedList = imported.childNodes; + + importedLen = importedList.length; + + assertEquals("documentimportnode13",0,importedLen); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode13</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode14.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode14.html new file mode 100644 index 0000000000..aeeb38ebdb --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode14.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/level2/core/documentimportnode14</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode14']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode14'; + + +/** +* + Using the method importNode with deep=true, import the fourth employee element node of this + Document. Verify if the node has been imported correctly by checking + if the default attribute present on this node has not been imported + and an explicit attribute has been imported. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=402 +*/ +function documentimportnode14() { + var success; + if(checkInitialization(builder, "documentimportnode14") != null) return; + var doc; + var newDoc; + var domImpl; + var nullDocType = null; + + var childList; + var imported; + var employeeElem; + var attrNode; + var attrValue; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("*","employee"); + employeeElem = childList.item(3); + domImpl = getImplementation(); +newDoc = domImpl.createDocument(nullNS,"staff",nullDocType); + imported = newDoc.importNode(employeeElem,true); + attrNode = imported.getAttributeNodeNS(nullNS,"defaultAttr"); + assertNull("defaultAttrNotImported",attrNode); + attrValue = imported.getAttributeNS("http://www.w3.org/2000/xmlns/","emp"); + assertEquals("explicitAttrImported","http://www.nist.gov",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode14</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode15.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode15.html new file mode 100644 index 0000000000..4b9d08e33e --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode15.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/level2/core/documentimportnode15</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode15']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docsLoaded += preload(docImpRef, "docImp", "staffNS"); + + 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 = 'documentimportnode15'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import a newly created Text node for this + Document. Verify if the node has been imported correctly by checking the value of the + imported text node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode15() { + var success; + if(checkInitialization(builder, "documentimportnode15") != null) return; + var doc; + var docImp; + var textImport; + var textToImport; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docImp = load(docImpRef, "docImp", "staffNS"); + textToImport = doc.createTextNode("Document.importNode test for a TEXT_NODE"); + textImport = doc.importNode(textToImport,true); + nodeValue = textImport.nodeValue; + + assertEquals("documentimportnode15","Document.importNode test for a TEXT_NODE",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode15</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode17.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode17.html new file mode 100644 index 0000000000..03660bc8a2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode17.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/level2/core/documentimportnode17</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode17']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docsLoaded += preload(docImpRef, "docImp", "staffNS"); + + 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 = 'documentimportnode17'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import a newly created Comment node for this + Document. Verify if the node has been imported correctly by checking the value of the + imported Comment node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode17() { + var success; + if(checkInitialization(builder, "documentimportnode17") != null) return; + var doc; + var docImp; + var commentImport; + var commentToImport; + var nodeValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docImp = load(docImpRef, "docImp", "staffNS"); + commentToImport = doc.createComment("Document.importNode test for a COMMENT_NODE"); + commentImport = doc.importNode(commentToImport,true); + nodeValue = commentImport.nodeValue; + + assertEquals("documentimportnode17","Document.importNode test for a COMMENT_NODE",nodeValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode17</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode18.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode18.html new file mode 100644 index 0000000000..86d7198884 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode18.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/level2/core/documentimportnode18</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode18']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docsLoaded += preload(docImpRef, "docImp", "staffNS"); + + 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 = 'documentimportnode18'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import a newly created PI node for this + Document. Verify if the node has been imported correctly by checking the PITarget and + PIData values of the imported PI node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode18() { + var success; + if(checkInitialization(builder, "documentimportnode18") != null) return; + var doc; + var docImp; + var piImport; + var piToImport; + var piData; + var piTarget; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docImpRef = null; + if (typeof(this.docImp) != 'undefined') { + docImpRef = this.docImp; + } + docImp = load(docImpRef, "docImp", "staffNS"); + piToImport = doc.createProcessingInstruction("Target","Data"); + piImport = doc.importNode(piToImport,false); + piTarget = piImport.target; + + piData = piImport.data; + + assertEquals("documentimportnode18_Target","Target",piTarget); + assertEquals("documentimportnode18_Data","Data",piData); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode18</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode19.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode19.html new file mode 100644 index 0000000000..95daf1261b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode19.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/level2/core/documentimportnode19</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode19']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode19'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true/false, import a entity nodes ent2 and ent6 + from this document to a new document object. Verify if the nodes have been + imported correctly by checking the nodeNames of the imported nodes and public and system ids. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode19() { + var success; + if(checkInitialization(builder, "documentimportnode19") != null) return; + var doc; + var docTypeNull = null; + + var docImp; + var domImpl; + var docType; + var nodeMap; + var entity2; + var entity6; + var entityImp2; + var entityImp6; + var nodeName; + var systemId; + var notationName; + var nodeNameImp; + var systemIdImp; + var notationNameImp; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docType = doc.doctype; + + docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull); + nodeMap = docType.entities; + + assertNotNull("entitiesNotNull",nodeMap); +entity2 = nodeMap.getNamedItem("ent2"); + entity6 = nodeMap.getNamedItem("ent6"); + entityImp2 = docImp.importNode(entity2,false); + entityImp6 = docImp.importNode(entity6,true); + nodeName = entity2.nodeName; + + nodeNameImp = entityImp2.nodeName; + + assertEquals("documentimportnode19_Ent2NodeName",nodeName,nodeNameImp); + nodeName = entity6.nodeName; + + nodeNameImp = entityImp6.nodeName; + + assertEquals("documentimportnode19_Ent6NodeName",nodeName,nodeNameImp); + systemId = entity2.systemId; + + systemIdImp = entityImp2.systemId; + + assertEquals("documentimportnode19_Ent2SystemId",systemId,systemIdImp); + systemId = entity6.systemId; + + systemIdImp = entityImp6.systemId; + + assertEquals("documentimportnode19_Ent6SystemId",systemId,systemIdImp); + notationName = entity2.notationName; + + notationNameImp = entityImp2.notationName; + + assertEquals("documentimportnode19_Ent2NotationName",notationName,notationNameImp); + notationName = entity6.notationName; + + notationNameImp = entityImp6.notationName; + + assertEquals("documentimportnode19_Ent6NotationName",notationName,notationNameImp); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode19</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode20.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode20.html new file mode 100644 index 0000000000..0a25a343b6 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode20.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/level2/core/documentimportnode20</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode20']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("expandEntityReferences", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode20'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, import a entity node ent4 + from this document to a new document object. The replacement text of this entity is an element + node, a cdata node and a pi. Verify if the nodes have been + imported correctly by checking the nodeNames of the imported element node, the data for the + cdata nodes and the PItarget and PIData for the pi nodes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode20() { + var success; + if(checkInitialization(builder, "documentimportnode20") != null) return; + var doc; + var docImp; + var domImpl; + var docType; + var docTypeNull = null; + + var nodeMap; + var entity4; + var entityImp4; + var element; + var cdata; + var pi; + var childList; + var elemchildList; + var ent4Name; + var ent4ImpName; + var cdataVal; + var piTargetVal; + var piDataVal; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docType = doc.doctype; + + docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull); + nodeMap = docType.entities; + + entity4 = nodeMap.getNamedItem("ent4"); + entityImp4 = docImp.importNode(entity4,true); + childList = entityImp4.childNodes; + + element = childList.item(0); + elemchildList = element.childNodes; + + cdata = elemchildList.item(0); + pi = childList.item(1); + ent4Name = entity4.nodeName; + + ent4ImpName = entityImp4.nodeName; + + cdataVal = cdata.data; + + piTargetVal = pi.target; + + piDataVal = pi.data; + + assertEquals("documentimportnode20_Ent4NodeName",ent4Name,ent4ImpName); + assertEquals("documentimportnode20_Cdata","Element data",cdataVal); + assertEquals("documentimportnode20_PITarget","PItarget",piTargetVal); + assertEquals("documentimportnode20_PIData","PIdata",piDataVal); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode20</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html new file mode 100644 index 0000000000..c117575f24 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode21.html @@ -0,0 +1,178 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode21</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode21']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("expandEntityReferences", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode21'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true, retreive the entity refs present in the + second element node whose tagName is address and import these nodes into another document. + Verify if the nodes have been imported correctly by checking the nodeNames of the + imported nodes, since they are imported into a new document which doesnot have thes defined, + the imported nodes should not have any children. + Now import the entityRef nodes into the same document and verify if the nodes have been + imported correctly by checking the nodeNames of the imported nodes, and by checking the + value of the replacement text of the imported nodes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode21() { + var success; + if(checkInitialization(builder, "documentimportnode21") != null) return; + var doc; + var docTypeNull = null; + + var docImp; + var domImpl; + var addressList; + var addressChildList; + var element; + var entRef2; + var entRefImp2; + var entRef3; + var entRefImp3; + var nodeName2; + var nodeName3; + var nodeNameImp2; + var nodeNameImp3; + var nodes; + var nodeImp3; + var nodeImp2; + var nodeValueImp2; + var nodeValueImp3; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull); + addressList = doc.getElementsByTagName("address"); + element = addressList.item(1); + addressChildList = element.childNodes; + + entRef2 = addressChildList.item(0); + entRef3 = addressChildList.item(2); + entRefImp2 = docImp.importNode(entRef2,true); + entRefImp3 = docImp.importNode(entRef3,false); + nodeName2 = entRef2.nodeName; + + nodeName3 = entRef3.nodeName; + + nodeNameImp2 = entRefImp2.nodeName; + + nodeNameImp3 = entRefImp3.nodeName; + + assertEquals("documentimportnode21_Ent2NodeName",nodeName2,nodeNameImp2); + assertEquals("documentimportnode21_Ent3NodeName",nodeName3,nodeNameImp3); + entRefImp2 = doc.importNode(entRef2,true); + entRefImp3 = doc.importNode(entRef3,false); + nodes = entRefImp2.childNodes; + + nodeImp2 = nodes.item(0); + nodeValueImp2 = nodeImp2.nodeValue; + + nodes = entRefImp3.childNodes; + + nodeImp3 = nodes.item(0); + nodeValueImp3 = nodeImp3.nodeValue; + + assertEquals("documentimportnode21_Ent2NodeValue","1900 Dallas Road",nodeValueImp2); + assertEquals("documentimportnode21_Ent3Nodevalue","Texas",nodeValueImp3); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode21</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html b/dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html new file mode 100644 index 0000000000..3e5a1e9e18 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documentimportnode22.html @@ -0,0 +1,181 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode22</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documentimportnode22']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documentimportnode22'; + + +/** +* + The importNode method imports a node from another document to this document. + The returned node has no parent; (parentNode is null). The source node is not + altered or removed from the original document but a new copy of the source node + is created. + + Using the method importNode with deep=true/false, import two notaiton nodes into the + same and different documnet objects. In each case check if valid public and systemids + are returned if any and if none, check if a null value was returned. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function documentimportnode22() { + var success; + if(checkInitialization(builder, "documentimportnode22") != null) return; + var doc; + var docTypeNull = null; + + var docImp; + var domImpl; + var docType; + var nodeMap; + var notation1; + var notation2; + var notationImp1; + var notationImp2; + var notationImpNew1; + var notationImpNew2; + var publicId1; + var publicId1Imp; + var publicId1NewImp; + var publicId2Imp; + var publicId2NewImp; + var systemId1Imp; + var systemId1NewImp; + var systemId2; + var systemId2Imp; + var systemId2NewImp; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docType = doc.doctype; + + docImp = domImpl.createDocument("http://www.w3.org/DOM/Test","a:b",docTypeNull); + nodeMap = docType.notations; + + assertNotNull("notationsNotNull",nodeMap); +notation1 = nodeMap.getNamedItem("notation1"); + notation2 = nodeMap.getNamedItem("notation2"); + notationImp1 = doc.importNode(notation1,true); + notationImp2 = doc.importNode(notation2,false); + notationImpNew1 = docImp.importNode(notation1,false); + notationImpNew2 = docImp.importNode(notation2,true); + publicId1 = notation1.publicId; + + publicId1Imp = notation1.publicId; + + publicId1NewImp = notation1.publicId; + + systemId1Imp = notation1.systemId; + + systemId1NewImp = notation1.systemId; + + publicId2Imp = notation2.publicId; + + publicId2NewImp = notation2.publicId; + + systemId2 = notation2.systemId; + + systemId2Imp = notation2.systemId; + + systemId2NewImp = notation2.systemId; + + assertEquals("documentimportnode22_N1PID",publicId1,publicId1Imp); + assertEquals("documentimportnode22_N1NPID",publicId1,publicId1NewImp); + assertNull("documentimportnode22_N1SID",systemId1Imp); + assertNull("documentimportnode22_N1NSID",systemId1NewImp); + assertEquals("documentimportnode22_N2SID",systemId2,systemId2Imp); + assertEquals("documentimportnode22_N2NSID",systemId2,systemId2NewImp); + assertNull("documentimportnode22_N2PID",publicId2Imp); + assertNull("documentimportnode22_N2NPID",publicId2Imp); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode22</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html b/dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html new file mode 100644 index 0000000000..e04a853256 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documenttypepublicid01.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypepublicid01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypepublicid01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypepublicid01'; + + +/** +* + The method getInternalSubset() returns the public identifier of the external subset. + + Create a new DocumentType node with the value "PUB" for its publicId. + Check the value of the publicId attribute using getPublicId(). + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function documenttypepublicid01() { + var success; + if(checkInitialization(builder, "documenttypepublicid01") != null) return; + var doc; + var docType; + var domImpl; + var publicId; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docType = domImpl.createDocumentType("l2:root","PUB",nullNS); + publicId = docType.publicId; + + assertEquals("documenttypepublicid01","PUB",publicId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypepublicid01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.html b/dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.html new file mode 100644 index 0000000000..973b6a9992 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_documenttypesystemid01.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/level2/core/documenttypesystemid01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['documenttypesystemid01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'documenttypesystemid01'; + + +/** +* + The method getInternalSubset() returns the public identifier of the external subset. + + Create a new DocumentType node with the value "SYS" for its systemId and PUB for + its publicId. Check the value of the systemId and pbulicId attributes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId +*/ +function documenttypesystemid01() { + var success; + if(checkInitialization(builder, "documenttypesystemid01") != null) return; + var doc; + var docType; + var domImpl; + var publicId; + var systemId; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +docType = domImpl.createDocumentType("l2:root","PUB","SYS"); + publicId = docType.publicId; + + systemId = docType.systemId; + + assertEquals("documenttypepublicid01","PUB",publicId); + assertEquals("documenttypesystemid01","SYS",systemId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/documenttypesystemid01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.html new file mode 100644 index 0000000000..eaf5d4832e --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument03.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/level2/core/domimplementationcreatedocument03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocument03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocument03'; + + +/** +* + The createDocument method with valid arguments, should create a DOM Document of + the specified type. + + Call the createDocument on this DOMImplementation with + createDocument ("http://www.w3.org/DOMTest/L2",see the array below for valid QNames,null). + Check if the returned Document object is is empty with no Document Element. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +*/ +function domimplementationcreatedocument03() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocument03") != null) return; + var doc; + var domImpl; + var newDoc; + var docType = null; + + var namespaceURI = "http://www.w3.org/DOMTest/L2"; + var qualifiedName; + qualifiedNames = new Array(); + qualifiedNames[0] = "_:_"; + qualifiedNames[1] = "_:h0"; + qualifiedNames[2] = "_:test"; + qualifiedNames[3] = "l_:_"; + qualifiedNames[4] = "ns:_0"; + qualifiedNames[5] = "ns:a0"; + qualifiedNames[6] = "ns0:test"; + qualifiedNames[7] = "a.b:c"; + qualifiedNames[8] = "a-b:c"; + qualifiedNames[9] = "a-b:c"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +for(var indexN65643 = 0;indexN65643 < qualifiedNames.length; indexN65643++) { + qualifiedName = qualifiedNames[indexN65643]; + newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + assertNotNull("domimplementationcreatedocument03",newDoc); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.html new file mode 100644 index 0000000000..f141c3ee55 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument04.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/level2/core/domimplementationcreatedocument04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocument04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocument04'; + + +/** +* + The createDocument method should throw a NAMESPACE_ERR if the qualifiedName has + a prefix and the namespaceURI is null. + + Call the createDocument on this DOMImplementation with null namespaceURI and a + qualifiedName that has a namespace prefix using this DOMImplementation. + Check if the NAMESPACE_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +*/ +function domimplementationcreatedocument04() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocument04") != null) return; + var doc; + var domImpl; + var newDoc; + var namespaceURI = null; + + var qualifiedName = "dom:root"; + var docType = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("domimplementationcreatedocument04",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.html new file mode 100644 index 0000000000..9fe0a35e79 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument05.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/level2/core/domimplementationcreatedocument05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocument05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocument05'; + + +/** +* + The createDocument method should throw a NAMESPACE_ERR if the qualifiedName has + a prefix that is xml and the namespaceURI is different from + http://www..w3.org/XML/1998/namespace. + + Call the createDocument on this DOMImplementation with namespaceURI that is + http://www.w3.org/xml/1998/namespace and a qualifiedName that has the prefix xml + Check if the NAMESPACE_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +*/ +function domimplementationcreatedocument05() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocument05") != null) return; + var doc; + var domImpl; + var newDoc; + var namespaceURI = "http://www.w3.org/xml/1998/namespace"; + var qualifiedName = "xml:root"; + var docType = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("domimplementationcreatedocument05",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.html new file mode 100644 index 0000000000..46c75fc363 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocument07.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/level2/core/domimplementationcreatedocument07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocument07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocument07'; + + +/** +* + The createDocument method should raise a NAMESPACE_ERR if the qualifiedName is malformed + + Invoke the createDocument method on this DOMImplementation object with null values + for namespaceURI and docType and a malformed qualifiedName. + The NAMESPACE_ERR should be raised. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +*/ +function domimplementationcreatedocument07() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocument07") != null) return; + var doc; + var domImpl; + var newDoc; + var namespaceURI = "http://www.w3.org/DOMTest/level2"; + var docType = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; + + { + success = false; + try { + newDoc = domImpl.createDocument(namespaceURI,":",docType); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("domimplementationcreatedocument07",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.html new file mode 100644 index 0000000000..35d1d7d40f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype01.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/level2/core/domimplementationcreatedocumenttype01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocumenttype01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocumenttype01'; + + +/** +* + The method createDocumentType with valid values for qualifiedName, publicId and + systemId should create an empty DocumentType node. + + Invoke createDocument on this DOMImplementation with a valid qualifiedName and different + publicIds and systemIds. Check if the the DocumentType node was created with its + ownerDocument attribute set to null. + + The specification has changed! ownerDocument should not be null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument +*/ +function domimplementationcreatedocumenttype01() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocumenttype01") != null) return; + var doc; + var domImpl; + var newDocType; + var ownerDocument; + var qualifiedName = "test:root"; + var publicId; + var systemId; + publicIds = new Array(); + publicIds[0] = "1234"; + publicIds[1] = "test"; + + systemIds = new Array(); + systemIds[0] = ""; + systemIds[1] = "test"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +for(var indexN65629 = 0;indexN65629 < publicIds.length; indexN65629++) { + publicId = publicIds[indexN65629]; + for(var indexN65633 = 0;indexN65633 < systemIds.length; indexN65633++) { + systemId = systemIds[indexN65633]; + newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId); + assertNotNull("domimplementationcreatedocumenttype01_newDocType",newDocType); +ownerDocument = newDocType.ownerDocument; + + assertNotNull("domimplementationcreatedocumenttype01_ownerDocument",ownerDocument); + + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.html new file mode 100644 index 0000000000..8ddd1126b8 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype02.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/level2/core/domimplementationcreatedocumenttype02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocumenttype02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocumenttype02'; + + +/** +* + The method createDocumentType with valid values for qualifiedName, publicId and + systemId should create an empty DocumentType node. + + Invoke createDocument on this DOMImplementation with a different valid qualifiedNames + and a valid publicId and systemId. Check if the the DocumentType node was created + with its ownerDocument attribute set to null. + + The specification has changed! ownerDocument should not be null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType +*/ +function domimplementationcreatedocumenttype02() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocumenttype02") != null) return; + var doc; + var domImpl; + var newDocType; + var ownerDocument; + var publicId = "http://www.w3.org/DOM/Test/dom2.dtd"; + var systemId = "dom2.dtd"; + var qualifiedName; + qualifiedNames = new Array(); + qualifiedNames[0] = "_:_"; + qualifiedNames[1] = "_:h0"; + qualifiedNames[2] = "_:test"; + qualifiedNames[3] = "_:_."; + qualifiedNames[4] = "_:a-"; + qualifiedNames[5] = "l_:_"; + qualifiedNames[6] = "ns:_0"; + qualifiedNames[7] = "ns:a0"; + qualifiedNames[8] = "ns0:test"; + qualifiedNames[9] = "ns:EEE."; + qualifiedNames[10] = "ns:_-"; + qualifiedNames[11] = "a.b:c"; + qualifiedNames[12] = "a-b:c.j"; + qualifiedNames[13] = "a-b:c"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +for(var indexN65655 = 0;indexN65655 < qualifiedNames.length; indexN65655++) { + qualifiedName = qualifiedNames[indexN65655]; + newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId); + assertNotNull("domimplementationcreatedocumenttype02_newDocType",newDocType); +ownerDocument = newDocType.ownerDocument; + + assertNotNull("domimplementationcreatedocumenttype02_ownerDocument",ownerDocument); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.html new file mode 100644 index 0000000000..6a5017d19a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationcreatedocumenttype04.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/level2/core/domimplementationcreatedocumenttype04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationcreatedocumenttype04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationcreatedocumenttype04'; + + +/** +* + The method createDocumentType should raise a INVALID_CHARACTER_ERR if the qualifiedName + contains an illegal characters. + + Invoke createDocument on this DOMImplementation with qualifiedNames having illegal characters. + Check if an INVALID_CHARACTER_ERR is raised in each case. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType +*/ +function domimplementationcreatedocumenttype04() { + var success; + if(checkInitialization(builder, "domimplementationcreatedocumenttype04") != null) return; + var doc; + var domImpl; + var newDocType; + var publicId = "http://www.w3.org/DOM/Test/dom2.dtd"; + var systemId = "dom2.dtd"; + var qualifiedName; + qualifiedNames = new Array(); + qualifiedNames[0] = "{"; + qualifiedNames[1] = "}"; + qualifiedNames[2] = "'"; + qualifiedNames[3] = "~"; + qualifiedNames[4] = "`"; + qualifiedNames[5] = "@"; + qualifiedNames[6] = "#"; + qualifiedNames[7] = "$"; + qualifiedNames[8] = "%"; + qualifiedNames[9] = "^"; + qualifiedNames[10] = "&"; + qualifiedNames[11] = "*"; + qualifiedNames[12] = "("; + qualifiedNames[13] = ")"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +for(var indexN65651 = 0;indexN65651 < qualifiedNames.length; indexN65651++) { + qualifiedName = qualifiedNames[indexN65651]; + + { + success = false; + try { + newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("domimplementationcreatedocumenttype04",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.html new file mode 100644 index 0000000000..828c2dd591 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturecore.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/level2/core/domimplementationfeaturecore</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationfeaturecore']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationfeaturecore'; + + +/** +* + + The "feature" parameter in the + + "hasFeature(feature,version)" method is the package name + + of the feature. Legal values are XML and HTML and CORE. + + (Test for feature core, lower case) + + + + 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 "core". + + The method should return a boolean "true". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7 +*/ +function domimplementationfeaturecore() { + var success; + if(checkInitialization(builder, "domimplementationfeaturecore") != 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("core","2.0"); +assertTrue("domimplementationFeaturecoreAssert",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturecore</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.html new file mode 100644 index 0000000000..0893a53964 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationfeaturexmlversion2.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/level2/core/domimplementationfeaturexmlversion2</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationfeaturexmlversion2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationfeaturexmlversion2'; + + +/** +* + + The "feature" parameter in the + + "hasFeature(feature,version)" method is the package name + + of the feature. Legal values are XML and HTML. + + (Test for feature "xml" and version "2.0") + + + + 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 "xml". + + The method should return a boolean "true". + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7 +*/ +function domimplementationfeaturexmlversion2() { + var success; + if(checkInitialization(builder, "domimplementationfeaturexmlversion2") != 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","2.0"); +assertTrue("domimplementationFeaturexmlVersion2Assert",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationfeaturexmlversion2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.html b/dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.html new file mode 100644 index 0000000000..fc18c9f2bd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_domimplementationhasfeature01.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/level2/core/domimplementationhasfeature01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['domimplementationhasfeature01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'domimplementationhasfeature01'; + + +/** +* + The method "hasFeature(feature,version)" tests if the DOMImplementation implements + a specific feature and if so returns true. + + Call the hasFeature method on this DOMImplementation with a combination of features + versions as below. Valid feature names are case insensitive and versions "2.0", + "1.0" and if the version is not specified, supporting any version of the feature + should return true. Check if the value returned value was true. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7 +*/ +function domimplementationhasfeature01() { + var success; + if(checkInitialization(builder, "domimplementationhasfeature01") != null) return; + var doc; + var domImpl; + var version = ""; + var version1 = "1.0"; + var version2 = "2.0"; + var featureCore; + var featureXML; + var success; + featuresXML = new Array(); + featuresXML[0] = "XML"; + featuresXML[1] = "xmL"; + + featuresCore = new Array(); + featuresCore[0] = "Core"; + featuresCore[1] = "CORE"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +for(var indexN65635 = 0;indexN65635 < featuresXML.length; indexN65635++) { + featureXML = featuresXML[indexN65635]; + success = domImpl.hasFeature(featureXML,version); +assertTrue("domimplementationhasfeature01_XML_1",success); +success = domImpl.hasFeature(featureXML,version1); +assertTrue("domimplementationhasfeature01_XML_2",success); + + } + for(var indexN65660 = 0;indexN65660 < featuresCore.length; indexN65660++) { + featureCore = featuresCore[indexN65660]; + success = domImpl.hasFeature(featureCore,version); +assertTrue("domimplementationhasfeature01_Core_1",success); +success = domImpl.hasFeature(featureCore,version1); +success = domImpl.hasFeature(featureCore,version2); +assertTrue("domimplementationhasfeature01_Core_3",success); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationhasfeature01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.html new file mode 100644 index 0000000000..6b3281fcd2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens01.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/level2/core/elementgetattributenodens01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetattributenodens01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetattributenodens01'; + + +/** +* + The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI. + Create a new element node and add 2 new attribute nodes to it that have the same + local name but different namespaceURIs and prefixes. + Retrieve an attribute using namespace and localname and check its value, name and + namespaceURI. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS +*/ +function elementgetattributenodens01() { + var success; + if(checkInitialization(builder, "elementgetattributenodens01") != null) return; + var doc; + var element; + var attribute1; + var attribute2; + var newAttribute1; + var newAttribute2; + var attribute; + var attrValue; + var attrName; + var attNodeName; + var attrLocalName; + var attrNS; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("namespaceURI","root"); + attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Level2","l2:att"); + newAttribute1 = element.setAttributeNodeNS(attribute1); + attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Level1","att"); + newAttribute2 = element.setAttributeNodeNS(attribute2); + attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2","att"); + attrValue = attribute.nodeValue; + + attrName = attribute.name; + + attNodeName = attribute.nodeName; + + attrLocalName = attribute.localName; + + attrNS = attribute.namespaceURI; + + assertEquals("elementgetattributenodens01_attrValue","",attrValue); + assertEquals("elementgetattributenodens01_attrName","l2:att",attrName); + assertEquals("elementgetattributenodens01_attrNodeName","l2:att",attNodeName); + assertEquals("elementgetattributenodens01_attrLocalName","att",attrLocalName); + assertEquals("elementgetattributenodens01_attrNs","http://www.w3.org/DOM/Level2",attrNS); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html new file mode 100644 index 0000000000..2e2a19301c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens02.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetattributenodens02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetattributenodens02'; + + +/** +* + The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI. + Create a new element node and add a new attribute node to it. Using the getAttributeNodeNS, + retrieve the newly added attribute node and check its value. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS +*/ +function elementgetattributenodens02() { + var success; + if(checkInitialization(builder, "elementgetattributenodens02") != null) return; + var doc; + var element; + var attribute; + var newAttribute1; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("namespaceURI","root"); + attribute = doc.createAttributeNS("http://www.w3.org/DOM/Level2","l2:att"); + newAttribute1 = element.setAttributeNodeNS(attribute); + attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2","att"); + attrValue = attribute.nodeValue; + + assertEquals("elementgetattributenodens02","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.html new file mode 100644 index 0000000000..0546491ae0 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributenodens03.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/level2/core/elementgetattributenodens03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetattributenodens03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetattributenodens03'; + + +/** +* + The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI. + Using the getAttributeNodeNS, retrieve and verify the value of the default + attribute node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function elementgetattributenodens03() { + var success; + if(checkInitialization(builder, "elementgetattributenodens03") != null) return; + var doc; + var element; + var attribute; + var attrValue; + var childList; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = childList.item(1); + attribute = element.getAttributeNodeNS(nullNS,"defaultAttr"); + attrValue = attribute.nodeValue; + + assertEquals("elementgetattributenodens03","defaultVal",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributenodens03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html b/dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html new file mode 100644 index 0000000000..29725f79e2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetattributens02.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributens02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetattributens02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetattributens02'; + + +/** +* + The method getAttributeNS retrieves an attribute value by local name and namespace URI. + Using the getAttributeNodeNS, retreive and verify the value of the default + attribute node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function elementgetattributens02() { + var success; + if(checkInitialization(builder, "elementgetattributens02") != null) return; + var doc; + var element; + var attrValue; + var childList; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + childList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = childList.item(1); + attrValue = element.getAttributeNS(nullNS,"defaultAttr"); + assertEquals("elementgetattributens02","defaultVal",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetattributens02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html new file mode 100644 index 0000000000..29a9c7f4ae --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens02.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagnamens02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagnamens02'; + + +/** +* + The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local + name and namespace URI in the order in which they are encountered in a preorder traversal + of the Document tree. + Invoke getElementsByTagNameNS on the documentElement with values for namespaceURI '*' and + localName '*'. Verify if this returns a nodeList of 0 elements. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function elementgetelementsbytagnamens02() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagnamens02") != null) return; + var doc; + var element; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.documentElement; + + elementList = element.getElementsByTagNameNS("**","*"); + assertSize("elementgetelementsbytagnamens02",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.html b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.html new file mode 100644 index 0000000000..b5d0e80c2b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens04.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/level2/core/elementgetelementsbytagnamens04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagnamens04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagnamens04'; + + +/** +* + Returns a NodeList of all the Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of the Document tree. + Create a new element node ('root') and append three newly created child nodes (all have + local name 'child' and defined in different namespaces). + Test 1: invoke getElementsByTagNameNS to retrieve one of the children. + Test 2: invoke getElementsByTagNameNS with the value of namespace equals to '*', and + verify that the node list has length of 3. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function elementgetelementsbytagnamens04() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagnamens04") != null) return; + var doc; + var element; + var child1; + var child2; + var child3; + var appendedChild; + var elementList; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM","root"); + child1 = doc.createElementNS("http://www.w3.org/DOM/Level1","dom:child"); + child2 = doc.createElementNS(nullNS,"child"); + child3 = doc.createElementNS("http://www.w3.org/DOM/Level2","dom:child"); + appendedChild = element.appendChild(child1); + appendedChild = element.appendChild(child2); + appendedChild = element.appendChild(child3); + elementList = element.getElementsByTagNameNS(nullNS,"child"); + assertSize("elementgetelementsbytagnamens04_1",1,elementList); +elementList = element.getElementsByTagNameNS("*","child"); + assertSize("elementgetelementsbytagnamens04_2",3,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.html b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.html new file mode 100644 index 0000000000..35ec75f156 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementgetelementsbytagnamens05.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/level2/core/elementgetelementsbytagnamens05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementgetelementsbytagnamens05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementgetelementsbytagnamens05'; + + +/** +* + Returns a NodeList of all the Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of the Document tree. + Invoke getElementsByTagNameNS on the documentElement with the following values: + namespaceURI: 'http://www.altavista.com' + localName: '*'. + Verify if this returns a nodeList of 1 elements. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function elementgetelementsbytagnamens05() { + var success; + if(checkInitialization(builder, "elementgetelementsbytagnamens05") != null) return; + var doc; + var element; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.documentElement; + + elementList = element.getElementsByTagNameNS("http://www.altavista.com","*"); + assertSize("elementgetelementsbytagnamens05",1,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html new file mode 100644 index 0000000000..930f8d0b50 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute01.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattribute01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementhasattribute01'; + + +/** +* + The method hasAttribute returns true when an attribute with a given name is specified + on this element or has a default value, false otherwise + Invoke the hasAttribute method to check if the documentElement has attributres. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function elementhasattribute01() { + var success; + if(checkInitialization(builder, "elementhasattribute01") != null) return; + var doc; + var element; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.documentElement; + + state = element.hasAttribute(""); + assertFalse("elementhasattribute01",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.html new file mode 100644 index 0000000000..0e03abcf2f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute02.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/level2/core/elementhasattribute02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattribute02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementhasattribute02'; + + +/** +* + The method hasAttribute returns true when an attribute with a given name is specified + on this element or has a default value, false otherwise + Invoke the hasAttribute method to on an element with default attributes and verify if it + returns true. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function elementhasattribute02() { + var success; + if(checkInitialization(builder, "elementhasattribute02") != null) return; + var doc; + var element; + var state; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:employee"); + element = elementList.item(0); + assertNotNull("empEmployeeNotNull",element); +state = element.hasAttribute("defaultAttr"); + assertTrue("elementhasattribute02",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.html new file mode 100644 index 0000000000..d63b213eee --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute03.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/level2/core/elementhasattribute03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattribute03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementhasattribute03'; + + +/** +* + The method hasAttribute returns true when an attribute with a given name is specified + on this element or has a default value, false otherwise. + + Create an element Node and an attribute Node. Invoke hasAttribute method + to verify that there is no attribute. Append the attribute node to the element node. + Invoke the hasAttribute method on the element and verify if it returns true. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function elementhasattribute03() { + var success; + if(checkInitialization(builder, "elementhasattribute03") != null) return; + var doc; + var element; + var state; + var attribute; + var newAttribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElement("address"); + attribute = doc.createAttribute("domestic"); + state = element.hasAttribute("domestic"); + assertFalse("elementhasattribute03_False",state); +newAttribute = element.setAttributeNode(attribute); + state = element.hasAttribute("domestic"); + assertTrue("elementhasattribute03_True",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.html new file mode 100644 index 0000000000..8e19f26794 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattribute04.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/level2/core/elementhasattribute04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattribute04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementhasattribute04'; + + +/** +* + The method hasAttribute returns true when an attribute with a given name is specified + on this element or has a default value, false otherwise. + + Create an element Node and an attribute Node and add the attribute node to the element. + Invoke the hasAttribute method on the element and verify if the method returns true. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function elementhasattribute04() { + var success; + if(checkInitialization(builder, "elementhasattribute04") != null) return; + var doc; + var element; + var state; + var attribute; + var newAttribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElement("address"); + attribute = doc.createAttribute("domestic"); + newAttribute = element.setAttributeNode(attribute); + state = element.hasAttribute("domestic"); + assertTrue("elementhasattribute04",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.html new file mode 100644 index 0000000000..9143e4f7b4 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens01.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/level2/core/elementhasattributens01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattributens01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementhasattributens01'; + + +/** +* + The method hasAttributeNS returns true when an attribute with a given local name + and namespace + URI is specified on this element or has a default value, false otherwise. + + Retreive the first employee element node. Invoke the hasAttributeNS method to check if it + has the xmlns attribute that belongs to the namespace http://www.w3.org/2000/xmlns/. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function elementhasattributens01() { + var success; + if(checkInitialization(builder, "elementhasattributens01") != null) return; + var doc; + var element; + var state; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","employee"); + element = elementList.item(0); + state = element.hasAttributeNS("http://www.w3.org/2000/xmlns/","xmlns"); + assertTrue("elementhasattributens01",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.html new file mode 100644 index 0000000000..b188a908c5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens02.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/level2/core/elementhasattributens02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattributens02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementhasattributens02'; + + +/** +* + The method hasAttributeNS returns true when an attribute with a given local + name and namespace URI is specified on this element or has a default value, + false otherwise. + + Create a new element and attribute node that belong to the same namespace. + Add the attribute node to the element node. Check if the newly created element + node has an attribute by invoking the hasAttributeNS method with appropriate + values for the namespaceURI and localName parameters. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function elementhasattributens02() { + var success; + if(checkInitialization(builder, "elementhasattributens02") != null) return; + var doc; + var element; + var state; + var attribute; + var newAttribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM","address"); + attribute = doc.createAttributeNS("http://www.w3.org/DOM","domestic"); + newAttribute = element.setAttributeNode(attribute); + state = element.hasAttributeNS("http://www.w3.org/DOM","domestic"); + assertTrue("hasDomesticAttr",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.html b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.html new file mode 100644 index 0000000000..b529accc4c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementhasattributens03.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/level2/core/elementhasattributens03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementhasattributens03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementhasattributens03'; + + +/** +* + The method hasAttributeNS returns true when an attribute with a given local name + and namespace URI is specified on this element or has a default value, + false otherwise. + + Create a new element and an attribute node that has an empty namespace. + Add the attribute node to the element node. Check if the newly created element + node has an attribute by invoking the hasAttributeNS method with appropriate + values for the namespaceURI and localName parameters. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function elementhasattributens03() { + var success; + if(checkInitialization(builder, "elementhasattributens03") != null) return; + var doc; + var element; + var state; + var attribute; + var newAttribute; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM","address"); + assertNotNull("createElementNotNull",element); +attribute = doc.createAttributeNS(nullNS,"domestic"); + newAttribute = element.setAttributeNode(attribute); + state = element.hasAttributeNS(nullNS,"domestic"); + assertTrue("elementhasattributens03",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattributens03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.html b/dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.html new file mode 100644 index 0000000000..feede9d7ca --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementremoveattributens01.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/level2/core/elementremoveattributens01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementremoveattributens01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementremoveattributens01'; + + +/** +* + The method removeAttributeNS removes an attribute by local name and namespace URI. + Create a new element and add a new attribute node to it. + Remove the attribute node using the removeAttributeNodeNS method. + Check if the attribute was remove by invoking the hasAttributeNS + method on the element and check if it returns false. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS +*/ +function elementremoveattributens01() { + var success; + if(checkInitialization(builder, "elementremoveattributens01") != null) return; + var doc; + var element; + var state; + var attribute; + var newAttribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM","elem"); + attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr"); + newAttribute = element.setAttributeNodeNS(attribute); + element.removeAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr"); + state = element.hasAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr"); + assertFalse("elementremoveattributens01",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementremoveattributens01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.html new file mode 100644 index 0000000000..41d6b47968 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens01.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/level2/core/elementsetattributenodens01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodens01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementsetattributenodens01'; + + +/** +* + Testing Element.setAttributeNodeNS: If an attribute with that local name + and that namespace URI is already present in the element, it is replaced + by the new one. + + Create a new element and two new attribute nodes (in the same namespace + and same localNames). + Add the two new attribute nodes to the element node using the + setAttributeNodeNS method. Check that only one attribute is added, check + the value of this attribute. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function elementsetattributenodens01() { + var success; + if(checkInitialization(builder, "elementsetattributenodens01") != null) return; + var doc; + var element; + var attribute1; + var attribute2; + var attrNode; + var attrName; + var attrNS; + var attrValue; + var attributes; + var newAttribute; + var length; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM/Test/Level2","new:element"); + attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p1:att"); + attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p2:att"); + attribute2.value = "value2"; + + newAttribute = element.setAttributeNodeNS(attribute1); + newAttribute = element.setAttributeNodeNS(attribute2); + attrNode = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/att1","att"); + attrName = attrNode.nodeName; + + attrNS = attrNode.namespaceURI; + + assertEquals("elementsetattributenodens01_attrName","p2:att",attrName); + assertEquals("elementsetattributenodens01_attrNS","http://www.w3.org/DOM/Test/att1",attrNS); + attributes = element.attributes; + + length = attributes.length; + + assertEquals("length",1,length); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.html new file mode 100644 index 0000000000..49ed31a8aa --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens02.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/level2/core/elementsetattributenodens02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodens02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodens02'; + + +/** +* + Test the setAttributeNodeNS method. + Retreive the street attribute from the second address element node. + Clone it and add it to the first address node. The INUSE_ATTRIBUTE_ERR exception + should not be thrown. Check the name and value of the newly added node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function elementsetattributenodens02() { + var success; + if(checkInitialization(builder, "elementsetattributenodens02") != null) return; + var doc; + var element; + var element2; + var attribute; + var attributeCloned; + var newAttr; + var elementList; + var attrName; + var attrValue; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(1); + attribute = element.getAttributeNodeNS(nullNS,"street"); + attributeCloned = attribute.cloneNode(true); + element2 = elementList.item(2); + newAttr = element2.setAttributeNodeNS(attributeCloned); + attrName = newAttr.nodeName; + + attrValue = newAttr.nodeValue; + + assertEquals("elementsetattributenodens02_attrName","street",attrName); + assertEquals("elementsetattributenodens02_attrValue","Yes",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.html new file mode 100644 index 0000000000..6d818edc9c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens03.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/level2/core/elementsetattributenodens03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodens03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodens03'; + + +/** +* + The method setAttributeNodeNS adds a new attribute and raises the + INUSE_ATTRIBUTE_ERR exception if the newAttr is already an attribute of + another Element object. + + Retreive an attribute node of an existing element node. Attempt to add it to an another + element node. Check if the INUSE_ATTRIBUTE_ERR exception is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function elementsetattributenodens03() { + var success; + if(checkInitialization(builder, "elementsetattributenodens03") != null) return; + var doc; + var element1; + var element2; + var attribute; + var newAttribute; + var elementList; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element1 = elementList.item(1); + attribute = element1.getAttributeNodeNS(nullNS,"street"); + element2 = elementList.item(2); + + { + success = false; + try { + newAttribute = element2.setAttributeNodeNS(attribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("elementsetattributenodens03",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.html new file mode 100644 index 0000000000..8d1ca94b1c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens04.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/level2/core/elementsetattributenodens04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodens04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodens04'; + + +/** +* + The method setAttributeNodeNS Adds a new attribute and raises an INUSE_ATTRIBUTE_ERR + if newAttr is already an attribute of another Element object. + + Create two new element nodes and a new attribute node. Attempt to add the same attribute + node to the same two element nodes. + Check if an INUSE_ATTRIBUTE_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function elementsetattributenodens04() { + var success; + if(checkInitialization(builder, "elementsetattributenodens04") != null) return; + var doc; + var element1; + var element2; + var attribute; + var newAttribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element1 = doc.createElementNS("http://www.w3.org/DOM/Test","elem1"); + element2 = doc.createElementNS("http://www.w3.org/DOM/Test","elem2"); + attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr"); + newAttribute = element1.setAttributeNodeNS(attribute); + + { + success = false; + try { + newAttribute = element2.setAttributeNodeNS(attribute); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("elementsetattributenodens04",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.html new file mode 100644 index 0000000000..3fb2eaaa93 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens05.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/level2/core/elementsetattributenodens05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodens05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docAltRef = null; + if (typeof(this.docAlt) != 'undefined') { + docAltRef = this.docAlt; + } + docsLoaded += preload(docAltRef, "docAlt", "staffNS"); + + 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 = 'elementsetattributenodens05'; + + +/** +* + The method setAttributeNodeNS Adds a new attribute and raises + an WRONG_DOCUMENT_ERR if newAttr was created from a different document + than the one that created the element. + Create new element and attribute nodes in different documents. + Attempt to add the attribute node to the element node. + Check if an WRONG_DOCUMENT_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function elementsetattributenodens05() { + var success; + if(checkInitialization(builder, "elementsetattributenodens05") != null) return; + var doc; + var docAlt; + var element; + var attribute; + var newAttribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var docAltRef = null; + if (typeof(this.docAlt) != 'undefined') { + docAltRef = this.docAlt; + } + docAlt = load(docAltRef, "docAlt", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test","elem1"); + attribute = docAlt.createAttributeNS("http://www.w3.org/DOM/Test","attr"); + + { + success = false; + try { + newAttribute = element.setAttributeNodeNS(attribute); + } + 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/level2/core/elementsetattributenodens05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.html new file mode 100644 index 0000000000..d165a7408e --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributenodens06.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/level2/core/elementsetattributenodens06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributenodens06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributenodens06'; + + +/** +* + The method setAttributeNodeNS Adds a new attribute and raises an WRONG_DOCUMENT_ERR if this node + is readonly. + + Attempt to add an attribute node to an element node which is part of the replacement text of + a read-only EntityReference node. + Check if a NO_MODIFICATION_ALLOWED_ERR is thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function elementsetattributenodens06() { + var success; + if(checkInitialization(builder, "elementsetattributenodens06") != null) return; + var doc; + var element; + var attribute; + var attribute2; + var entRef; + var elementList; + var newAttribute; + var newChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test","elem1"); + attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr"); + entRef = doc.createEntityReference("ent4"); + newChild = attribute.appendChild(entRef); + newAttribute = element.setAttributeNodeNS(attribute); + elementList = entRef.childNodes; + + element = elementList.item(0); + attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr2"); + + { + success = false; + try { + newAttribute = element.setAttributeNodeNS(attribute2); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("elementsetattributenodens06",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributenodens06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.html new file mode 100644 index 0000000000..3c8b8cea6a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens01.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/level2/core/elementsetattributens01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributens01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementsetattributens01'; + + +/** +* + The method setAttributeNS adds a new attribute. + Create a new element and add a new attribute node to it using the setAttributeNS method. + Check if the attribute was correctly set by invoking the getAttributeNodeNS method + and checking the nodeName and nodeValue of the returned nodes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +*/ +function elementsetattributens01() { + var success; + if(checkInitialization(builder, "elementsetattributens01") != null) return; + var doc; + var element; + var attribute; + var attrName; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM","dom:elem"); + element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS","attr","value"); + attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS","attr"); + attrName = attribute.nodeName; + + attrValue = attribute.nodeValue; + + assertEquals("elementsetattributens01_attrName","attr",attrName); + assertEquals("elementsetattributens01_attrValue","value",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.html new file mode 100644 index 0000000000..b3b3924abd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens02.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/level2/core/elementsetattributens02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributens02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'elementsetattributens02'; + + +/** +* + The method setAttributeNS adds a new attribute. + + Retrieve an existing element node with attributes and add a new attribute node to it using + the setAttributeNS method. Check if the attribute was correctly set by invoking the + getAttributeNodeNS method and checking the nodeName and nodeValue of the returned nodes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +*/ +function elementsetattributens02() { + var success; + if(checkInitialization(builder, "elementsetattributens02") != null) return; + var doc; + var element; + var attribute; + var elementList; + var attrName; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(0); + element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS","this:street","Silver Street"); + attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS","street"); + attrName = attribute.nodeName; + + attrValue = attribute.nodeValue; + + assertEquals("elementsetattributens02_attrName","this:street",attrName); + assertEquals("elementsetattributens02_attrValue","Silver Street",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.html new file mode 100644 index 0000000000..3764c4a7ac --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens03.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/level2/core/elementsetattributens03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributens03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributens03'; + + +/** +* + The method setAttributeNS adds a new attribute. + Retreive an existing element node with a default attribute node and + add two new attribute nodes that have the same local name as the + default attribute but different namespaceURI to it using the setAttributeNS method. + Check if the attribute was correctly set by invoking the getAttributeNodeNS method + and checking the nodeName and nodeValue of the returned nodes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +*/ +function elementsetattributens03() { + var success; + if(checkInitialization(builder, "elementsetattributens03") != null) return; + var doc; + var element; + var attribute; + var elementList; + var attrName; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:employee"); + element = elementList.item(0); + assertNotNull("empEmployeeNotNull",element); +element.setAttributeNS("http://www.w3.org/DOM/Test/1","defaultAttr","default1"); + element.setAttributeNS("http://www.w3.org/DOM/Test/2","defaultAttr","default2"); + attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/1","defaultAttr"); + attrName = attribute.nodeName; + + attrValue = attribute.nodeValue; + + assertEquals("elementsetattributens03_attrName","defaultAttr",attrName); + assertEquals("elementsetattributens03_attrValue","default1",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.html new file mode 100644 index 0000000000..4ba7eacda7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens04.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/level2/core/elementsetattributens04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributens04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributens04'; + + +/** +* + The method setAttributeNS adds a new attribute and raises a INVALID_CHARACTER_ERR if + the specified qualified name contains an illegal character. + Invoke the setAttributeNS method on this Element object with a valid value for + namespaceURI, and qualifiedNames that contain illegal characters. Check if the an + INVALID_CHARACTER_ERR was thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +*/ +function elementsetattributens04() { + var success; + if(checkInitialization(builder, "elementsetattributens04") != null) return; + var doc; + var element; + var qualifiedName; + qualifiedNames = new Array(); + qualifiedNames[0] = "/"; + qualifiedNames[1] = "//"; + qualifiedNames[2] = "\\"; + qualifiedNames[3] = ";"; + qualifiedNames[4] = "&"; + qualifiedNames[5] = "*"; + qualifiedNames[6] = "]]"; + qualifiedNames[7] = ">"; + qualifiedNames[8] = "<"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test/L2","dom:elem"); + for(var indexN65624 = 0;indexN65624 < qualifiedNames.length; indexN65624++) { + qualifiedName = qualifiedNames[indexN65624]; + + { + success = false; + try { + element.setAttributeNS("http://www.w3.org/DOM/Test/L2",qualifiedName,"test"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("elementsetattributens04",success); + } + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.html new file mode 100644 index 0000000000..7a8fce7f30 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens05.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/level2/core/elementsetattributens05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributens05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributens05'; + + +/** +* + The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR if the + qualifiedName has a prefix and the namespaceURI is null. + Invoke the setAttributeNS method on a new Element object with null namespaceURI and a + qualifiedName that has a namespace prefix. Check if the NAMESPACE_ERR was thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function elementsetattributens05() { + var success; + if(checkInitialization(builder, "elementsetattributens05") != null) return; + var doc; + var element; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test/L2","dom:elem"); + + { + success = false; + try { + element.setAttributeNS(nullNS,"dom:root","test"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("elementsetattributens05",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.html new file mode 100644 index 0000000000..dc181e460c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributens08.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/level2/core/elementsetattributens08</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributens08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributens08'; + + +/** +* + The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR + if the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is + different from "http://www.w3.org/2000/xmlns/". + + Invoke the setAttributeNS method on a new Element object with namespaceURI that is + http://www.w3.org/DOMTest/level2 and a qualifiedName that has the prefix xmlns and once + again with a qualifiedName that is xmlns. + Check if the NAMESPACE_ERR was thrown. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +*/ +function elementsetattributens08() { + var success; + if(checkInitialization(builder, "elementsetattributens08") != null) return; + var doc; + var element; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOMTest/level2","dom:elem"); + + { + success = false; + try { + element.setAttributeNS("http://www.w3.org/DOMTest/level2","xmlns","test"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("elementsetattributens08_Err1",success); + } + + { + success = false; + try { + element.setAttributeNS("http://www.w3.org/DOMTest/level2","xmlns:root","test"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("elementsetattributens08_Err2",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributens08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.html b/dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.html new file mode 100644 index 0000000000..b1cb68f8a9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_elementsetattributensurinull.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/level2/core/elementsetattributensurinull</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['elementsetattributensurinull']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'elementsetattributensurinull'; + + +/** +* + + The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a + + NAMESPACE_ERR DOMException if the specified + + qualifiedName has a prefix and the namespaceURI is null. + + + + Attempt to add a new attribute on the first employee node. + + An exception should be raised since the "qualifiedName" has a + + prefix and the namespaceURI is null. + + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function elementsetattributensurinull() { + var success; + if(checkInitialization(builder, "elementsetattributensurinull") != null) return; + var namespaceURI = null; + + var qualifiedName = "emp:qualifiedName"; + var doc; + var elementList; + var testAddr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + success = false; + try { + testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementsetattributensurinull</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.html new file mode 100644 index 0000000000..1e19275fa1 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS01.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/level2/core/getAttributeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNS01'; + + +/** +* + The "getAttributeNS(namespaceURI,localName)" method retrieves an + attribute value by local name and NamespaceURI. + + Retrieve the first "emp:address" element. + The value returned by the "getAttributeNS()" method should be the + value "DISTRICT" since the attribute has a default value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 +*/ +function getAttributeNS01() { + var success; + if(checkInitialization(builder, "getAttributeNS01") != null) return; + var namespaceURI = "http://www.nist.gov"; + var localName = "district"; + var qualifiedName = "emp:district"; + var doc; + var elementList; + var testAddr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + attrValue = testAddr.getAttributeNS(namespaceURI,localName); + assertEquals("attrValue","DISTRICT",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.html new file mode 100644 index 0000000000..b55b6e4dc1 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS02.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/level2/core/getAttributeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNS02'; + + +/** +* + The "getAttributeNS(namespaceURI,localName)" method retrieves an + attribute value by local name and NamespaceURI. + + Retrieve the first "emp:address" element. + Create a new attribute with the "createAttributeNS()" method. + Add the new attribute with the "setAttributeNS()" method. + The value returned by the "getAttributeNS()" method should be the + empty string since the attribute does not have a default value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +*/ +function getAttributeNS02() { + var success; + if(checkInitialization(builder, "getAttributeNS02") != null) return; + var namespaceURI = "http://www.nist.gov"; + var localName = "district"; + var qualifiedName = "emp:district"; + var doc; + var newAttribute; + var elementList; + var testAddr; + var districtAttr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + newAttribute = doc.createAttributeNS(namespaceURI,qualifiedName); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +districtAttr = testAddr.setAttributeNodeNS(newAttribute); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + attrValue = testAddr.getAttributeNS(namespaceURI,localName); + assertEquals("throw_Equals","",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.html new file mode 100644 index 0000000000..20e1196525 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS03.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/level2/core/getAttributeNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNS03'; + + +/** +* + The "getAttributeNS(namespaceURI,localName)" method retrieves an + attribute value by local name and NamespaceURI. + + Retrieve the first "emp:address" element. + The value returned by the "getAttributeNS()" method for the emp:domestic attribute + should be the empty string since the attribute does not have a specified value + because it was removed by the "removeAttributeNS()" method. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +*/ +function getAttributeNS03() { + var success; + if(checkInitialization(builder, "getAttributeNS03") != null) return; + var namespaceURI = "http://www.nist.gov"; + var localName = "domestic"; + var doc; + var elementList; + var testAddr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +testAddr.removeAttributeNS(namespaceURI,localName); + attrValue = testAddr.getAttributeNS(namespaceURI,localName); + assertEquals("throw_Equals",null,attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.html new file mode 100644 index 0000000000..5e57fef798 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS04.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/level2/core/getAttributeNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNS04'; + + +/** +* + The "getAttributeNS(namespaceURI,localName)" method retrieves an + attribute value by local name and NamespaceURI. + + Retrieve the first "emp:address" element. + Create a new attribute with the "createAttributeNS()" method. + Add the new attribute and value with the "setAttributeNS()" method. + The value returned by the "getAttributeNS()" method should be + the string "NewValue" since the attribute had a specified value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +*/ +function getAttributeNS04() { + var success; + if(checkInitialization(builder, "getAttributeNS04") != null) return; + var namespaceURI = "http://www.nist.gov"; + var localName = "blank"; + var qualifiedName = "emp:blank"; + var doc; + var newAttribute; + var elementList; + var testAddr; + var districtAttr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + newAttribute = doc.createAttributeNS(namespaceURI,qualifiedName); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +testAddr.setAttributeNS(namespaceURI,qualifiedName,"NewValue"); + attrValue = testAddr.getAttributeNS(namespaceURI,localName); + assertEquals("throw_Equals","NewValue",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.html new file mode 100644 index 0000000000..8605585b39 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNS05.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/level2/core/getAttributeNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNS05'; + + +/** +* + The "getAttributeNS(namespaceURI,localName)" method retrieves an + attribute value by local name and NamespaceURI. + + Retrieve the first emp:address element node + and retrieve the emp:domestic attribute. The method returns an + Attr value as a string, the "value" can be examined to ensure the + proper attribute value was retrieved. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +*/ +function getAttributeNS05() { + var success; + if(checkInitialization(builder, "getAttributeNS05") != null) return; + var doc; + var elementList; + var testAddr; + var attrValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +attrValue = testAddr.getAttributeNS("http://www.nist.gov","domestic"); + assertEquals("attrValue","Yes",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.html new file mode 100644 index 0000000000..59b2aed7d8 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS01.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/level2/core/getAttributeNodeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNodeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNodeNS01'; + + +/** +* + The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an + attribute node by local name and NamespaceURI. + + Retrieve the first emp:address element node. + The getAttributeNodeNS method returns an + Attr node, the "value" can be examined to ensure the + proper attribute node was retrieved. This attribute + value should be null since there is no such attribute. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS +*/ +function getAttributeNodeNS01() { + var success; + if(checkInitialization(builder, "getAttributeNodeNS01") != null) return; + var namespaceURI = "http://www.nist.gov"; + var localName = "invalidlocalname"; + var doc; + var elementList; + var testAddr; + var attribute; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +attribute = testAddr.getAttributeNodeNS(namespaceURI,localName); + assertNull("throw_Null",attribute); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNodeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.html b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.html new file mode 100644 index 0000000000..b55a8f97bd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getAttributeNodeNS02.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/level2/core/getAttributeNodeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getAttributeNodeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getAttributeNodeNS02'; + + +/** +* + The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an + attribute node by local name and NamespaceURI. + + Retrieve the first emp:address element node. + The getAttributeNodeNS method returns an + Attr node, the "value" can be examined to ensure the + proper attribute node was retrieved. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 +*/ +function getAttributeNodeNS02() { + var success; + if(checkInitialization(builder, "getAttributeNodeNS02") != null) return; + var doc; + var elementList; + var testAddr; + var attribute; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +attribute = testAddr.getAttributeNodeNS("http://www.nist.gov","domestic"); + attrName = attribute.nodeName; + + assertEquals("attrName","emp:domestic",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getAttributeNodeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementById01.html b/dom/tests/mochitest/dom-level2-core/test_getElementById01.html new file mode 100644 index 0000000000..8282eba33d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementById01.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/level2/core/getElementById01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementById01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementById01'; + + +/** +* + The "getElementById(elementId)" method for a + Document should return an element whose ID matches elementId. + + Invoke method getElementById(elementId) on this document + with elementId equals "CANADA". Method should return an element + whose tag name is "emp:address". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=383 +*/ +function getElementById01() { + var success; + if(checkInitialization(builder, "getElementById01") != null) return; + var doc; + var element; + var tagname; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.getElementById("CANADA"); + tagname = element.tagName; + + assertEquals("throw_Equals","emp:address",tagname); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementById02.html b/dom/tests/mochitest/dom-level2-core/test_getElementById02.html new file mode 100644 index 0000000000..2e145880db --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementById02.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementById02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementById02'; + + +/** +* + + The "getElementById(elementId)" method for a + Document should return null if elementId does not identify any + elements in this document. + + Invoke method getElementById(elementId) on this document + with elementId equals "Cancun". Method should return null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId +*/ +function getElementById02() { + var success; + if(checkInitialization(builder, "getElementById02") != null) return; + var doc; + var element; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.getElementById("Cancun"); + assertNull("throw_Null",element); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.html new file mode 100644 index 0000000000..f83e13382c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS01.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/level2/core/getElementsByTagNameNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS01'; + + +/** +* + Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document + with namespaceURI and localName as "*" and check size of returned node list. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS01() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS01") != null) return; + var namespaceURI = "*"; + var localName = "*"; + var doc; + var newList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + newList = doc.getElementsByTagNameNS(namespaceURI,localName); + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertSize("listLength_svg",39,newList); + + } + + else { + assertSize("listLength",37,newList); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.html new file mode 100644 index 0000000000..d2705a41ee --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS02.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/level2/core/getElementsByTagNameNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS02'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method for a + Document should return a new NodeList of all Elements with a given + localName and namespaceURI in the order they were encountered in a preorder + traversal of the document tree. + + Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document + with namespaceURI being " " and localName is "employee". + Method should return a new NodeList containing five Elements. + Retrieve the FOURTH element whose name should be "emp:employee". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS02() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS02") != null) return; + var doc; + var newList; + var newElement; + var prefix; + var lname; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + newList = doc.getElementsByTagNameNS("*","employee"); + assertSize("employeeCount",5,newList); +newElement = newList.item(3); + prefix = newElement.prefix; + + assertEquals("prefix","emp",prefix); + lname = newElement.localName; + + assertEquals("lname","employee",lname); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.html new file mode 100644 index 0000000000..de73f9e63c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS03.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/level2/core/getElementsByTagNameNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS03'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the "http://www.nist.gov" as the namespaceURI and the special value " " as the + localName. + The method should return a NodeList of elements that have "http://www.nist.gov + as a namespace URI. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS03() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS03") != null) return; + var doc; + var elementList; + var child; + var childName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "employee"; + expectedResult[1] = "employeeId"; + expectedResult[2] = "name"; + expectedResult[3] = "position"; + expectedResult[4] = "salary"; + expectedResult[5] = "gender"; + expectedResult[6] = "address"; + expectedResult[7] = "emp:employee"; + expectedResult[8] = "emp:employeeId"; + expectedResult[9] = "emp:position"; + expectedResult[10] = "emp:salary"; + expectedResult[11] = "emp:gender"; + expectedResult[12] = "emp:address"; + expectedResult[13] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","*"); + for(var indexN65654 = 0;indexN65654 < elementList.length; indexN65654++) { + child = elementList.item(indexN65654); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsList("nodeNames",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.html new file mode 100644 index 0000000000..8629f09dd5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS04.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/level2/core/getElementsByTagNameNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS04'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the special value " " as the namespaceURI and "address" as the + localName. + The method should return a NodeList of Elements that have + "address" as the local name. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS04() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS04") != null) return; + var doc; + var elementList; + var child; + var childName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "address"; + expectedResult[1] = "address"; + expectedResult[2] = "address"; + expectedResult[3] = "emp:address"; + expectedResult[4] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + for(var indexN65625 = 0;indexN65625 < elementList.length; indexN65625++) { + child = elementList.item(indexN65625); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsList("nodeNames",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.html new file mode 100644 index 0000000000..70f4d79e09 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS05.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/level2/core/getElementsByTagNameNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS05'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the "http://www.nist.gov" as the namespaceURI and "nomatch" as the + localName. + The method should return a NodeList whose length is + "0". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS05() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS05") != null) return; + var namespaceURI = "http://www.nist.gov"; + var localName = "nomatch"; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS(namespaceURI,localName); + assertSize("throw_Size",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.html new file mode 100644 index 0000000000..31c28fec9b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS06.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/level2/core/getElementsByTagNameNS06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS06'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the "http://www.nomatch.com" as the namespaceURI and "address" as the + localName. + The method should return a NodeList whose length is + "0". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS06() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS06") != null) return; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nomatch.com","address"); + assertSize("matchSize",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.html new file mode 100644 index 0000000000..1213a57f1a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS07.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/level2/core/getElementsByTagNameNS07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS07'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the string "http://www.nist.gov" as the namespaceURI and "address" as the + localName. + The method should return a NodeList whose length is + "3". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS +*/ +function getElementsByTagNameNS07() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS07") != null) return; + var doc; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + assertSize("addresses",3,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.html new file mode 100644 index 0000000000..a6d17fc92f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS08.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/level2/core/getElementsByTagNameNS08</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS08'; + + +/** +* + Element.getElementsByTagNameNS('*','*') should return all child + elements. There is some contention on whether this should match + unqualified elements, this test reflects the interpretation that + '*' should match elements in all namespaces and unqualified elements. + + Derived from getElementsByTagNameNS01 which tests similar functionality + on the Document interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS08() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS08") != null) return; + var doc; + var docElem; + var newList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + newList = docElem.getElementsByTagNameNS("*","*"); + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertSize("listSize_svg",38,newList); + + } + + else { + assertSize("listSize",36,newList); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.html new file mode 100644 index 0000000000..a0627b4b07 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS09.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/level2/core/getElementsByTagNameNS09</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS09'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method for a + Element should return a new NodeList of all descendant Elements with a given + localName and namespaceURI in the order they were encountered in a preorder + traversal of the document tree. + + Invoke method getElementsByTagNameNS(namespaceURI,localName) on the document + element with namespaceURI being "*" and localName is "employee". + Method should return a new NodeList containing five Elements. + Retrieve the FOURTH element whose name should be "emp:employee". + + Derived from getElementsByTagNameNS02 and reflects its interpretation + that namespace="*" matches namespace unqualified tagnames. + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS09() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS09") != null) return; + var doc; + var newList; + var newElement; + var prefix; + var lname; + var docElem; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + newList = docElem.getElementsByTagNameNS("*","employee"); + assertSize("employeeCount",5,newList); +newElement = newList.item(3); + prefix = newElement.prefix; + + assertEquals("prefix","emp",prefix); + lname = newElement.localName; + + assertEquals("lname","employee",lname); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.html new file mode 100644 index 0000000000..0da0362f93 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS10.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/level2/core/getElementsByTagNameNS10</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS10']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS10'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements of the document element + using the "http://www.nist.gov" as the namespaceURI and the special value "*" as the + localName. + The method should return a NodeList of elements that have "http://www.nist.gov + as a namespace URI. + + Derived from getElementsByTagNameNS03 + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS10() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS10") != null) return; + var doc; + var docElem; + var elementList; + var child; + var childName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "employee"; + expectedResult[1] = "employeeId"; + expectedResult[2] = "name"; + expectedResult[3] = "position"; + expectedResult[4] = "salary"; + expectedResult[5] = "gender"; + expectedResult[6] = "address"; + expectedResult[7] = "emp:employee"; + expectedResult[8] = "emp:employeeId"; + expectedResult[9] = "emp:position"; + expectedResult[10] = "emp:salary"; + expectedResult[11] = "emp:gender"; + expectedResult[12] = "emp:address"; + expectedResult[13] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","*"); + for(var indexN65662 = 0;indexN65662 < elementList.length; indexN65662++) { + child = elementList.item(indexN65662); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsList("nodeNames",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS10</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.html new file mode 100644 index 0000000000..0d1ac477b2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS11.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/level2/core/getElementsByTagNameNS11</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS11']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS11'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the special value "*" as the namespaceURI and "address" as the + localName. + The method should return a NodeList of Elements that have + "address" as the local name. + + This test is derived from getElementsByTagNameNS04 + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS11() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS11") != null) return; + var doc; + var docElem; + var elementList; + var child; + var childName; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "address"; + expectedResult[1] = "address"; + expectedResult[2] = "address"; + expectedResult[3] = "emp:address"; + expectedResult[4] = "address"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + elementList = docElem.getElementsByTagNameNS("*","address"); + for(var indexN65630 = 0;indexN65630 < elementList.length; indexN65630++) { + child = elementList.item(indexN65630); + childName = child.nodeName; + + result[result.length] = childName; + + } + assertEqualsList("nodeNames",expectedResult,result); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS11</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html new file mode 100644 index 0000000000..38b000d502 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS12.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS12</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS12']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS12'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the "http://www.nist.gov" as the namespaceURI and "nomatch" as the + localName. + The method should return a NodeList whose length is "0". + + This test is a modification of getElementsByTagName05 + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS12() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS12") != null) return; + var doc; + var docElem; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","nomatch"); + assertSize("size",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS12</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html new file mode 100644 index 0000000000..68c1b1b6c6 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS13.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS13</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS13']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS13'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the "http://www.nomatch.com" as the namespaceURI and "address" as the + localName. + The method should return a NodeList whose length is + "0". + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS13() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS13") != null) return; + var doc; + var docElem; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + elementList = docElem.getElementsByTagNameNS("http://www.nomatch.com","address"); + assertSize("matchSize",0,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS13</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html new file mode 100644 index 0000000000..ddad169e86 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getElementsByTagNameNS14.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS14</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getElementsByTagNameNS14']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getElementsByTagNameNS14'; + + +/** +* + The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList + of all descendant Elements with a given local name and namespace URI in the + order in which they are encountered in a preorder traversal of this Element tree. + + Create a NodeList of all the descendant elements + using the string "http://www.nist.gov" as the namespaceURI and "address" as the + localName. + The method should return a NodeList whose length is + "3". + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D +*/ +function getElementsByTagNameNS14() { + var success; + if(checkInitialization(builder, "getElementsByTagNameNS14") != null) return; + var doc; + var docElem; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docElem = doc.documentElement; + + elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","address"); + assertSize("addresses",3,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementsByTagNameNS14</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.html new file mode 100644 index 0000000000..95eaeb9487 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS01.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/level2/core/getNamedItemNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getNamedItemNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getNamedItemNS01'; + + +/** +* + The "getNamedItemNS(namespaceURI,localName)" method for a + NamedNodeMap should return a node specified by localName and namespaceURI + + Retrieve a list of elements with tag name "address". + Access the second element from the list and get its attributes. + Try to retrieve the attribute node with local name "domestic" + and namespace uri "http://www.usa.com" with + method getNamedItemNS(namespaceURI,localName). + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 +*/ +function getNamedItemNS01() { + var success; + if(checkInitialization(builder, "getNamedItemNS01") != 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", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + domesticAttr = attributes.getNamedItemNS("http://www.usa.com","domestic"); + attrName = domesticAttr.nodeName; + + assertEquals("attrName","dmstc:domestic",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.html new file mode 100644 index 0000000000..363f5eda30 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS02.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/level2/core/getNamedItemNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getNamedItemNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getNamedItemNS02'; + + +/** +* + The "getNamedItemNS(namespaceURI,localName)" method for a + NamedNodeMap should return null + if parameters do not identify any node in this map. + + Retrieve a list of elements with tag name "address". + Access the second element from the list and get its attributes. + Try to retrieve an attribute node with local name "domest" + and namespace uri "http://www.usa.com" with + method getNamedItemNS(namespaceURI,localName). + This should return null because "domest" does not match any local names in this map. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function getNamedItemNS02() { + var success; + if(checkInitialization(builder, "getNamedItemNS02") != null) return; + var namespaceURI = "http://www.usa.com"; + var localName = "domest"; + var doc; + var elementList; + var testEmployee; + var attributes; + var newAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testEmployee = elementList.item(1); + attributes = testEmployee.attributes; + + newAttr = attributes.getNamedItemNS(namespaceURI,localName); + assertNull("throw_Null",newAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html new file mode 100644 index 0000000000..e10a61e047 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS03.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getNamedItemNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getNamedItemNS03'; + + +/** +* +Entity nodes are not namespaced and should not be retrievable using +getNamedItemNS. + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function getNamedItemNS03() { + var success; + if(checkInitialization(builder, "getNamedItemNS03") != null) return; + var doc; + var docType; + var entities; + var entity; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entity = entities.getNamedItemNS(nullNS,"ent1"); + assertNull("entityNull",entity); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html new file mode 100644 index 0000000000..6e73498873 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_getNamedItemNS04.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['getNamedItemNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'getNamedItemNS04'; + + +/** +* +Notation nodes are not namespaced and should not be retrievable using +getNamedItemNS. + +* @author Curt Arnold +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function getNamedItemNS04() { + var success; + if(checkInitialization(builder, "getNamedItemNS04") != null) return; + var doc; + var docType; + var notations; + var notation; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notation = notations.getNamedItemNS(nullNS,"notation1"); + assertNull("notationNull",notation); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/getNamedItemNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html new file mode 100644 index 0000000000..a6b29858d6 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute01.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttribute01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttribute01'; + + +/** +* + The "hasAttribute()" method for an Element should + return true if the element has an attribute with the given name. + + Retrieve the first "address" element and the "hasAttribute()" method + should return false since the element does not have a default value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr +*/ +function hasAttribute01() { + var success; + if(checkInitialization(builder, "hasAttribute01") != null) return; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(4); + state = testNode.hasAttribute("domestic"); + assertFalse("throw_False",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute02.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute02.html new file mode 100644 index 0000000000..bd4b87c9a1 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute02.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/level2/core/hasAttribute02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttribute02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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 = 'hasAttribute02'; + + +/** +* + The "hasAttribute()" method for an Element should + return true if the element has an attribute with the given name. + + Retrieve the first "address" element and the "hasAttribute()" method + should return true since the attribute "street" has a default value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 +*/ +function hasAttribute02() { + var success; + if(checkInitialization(builder, "hasAttribute02") != null) return; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(0); + state = testNode.hasAttribute("street"); + assertTrue("throw_True",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html new file mode 100644 index 0000000000..fd09860de2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute03.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttribute03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttribute03'; + + +/** +* + The "hasAttribute()" method for an Element should + return false if the element does not have an attribute with the given name. + + Retrieve the first "address" element and the "hasAttribute()" method + should return false since the element does not have "nomatch" as an attribute. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr +*/ +function hasAttribute03() { + var success; + if(checkInitialization(builder, "hasAttribute03") != null) return; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(0); + state = testNode.hasAttribute("nomatch"); + assertFalse("throw_False",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttribute04.html b/dom/tests/mochitest/dom-level2-core/test_hasAttribute04.html new file mode 100644 index 0000000000..6213e84309 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttribute04.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/level2/core/hasAttribute04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttribute04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttribute04'; + + +/** +* + The "hasAttribute()" method for an Element should + return true if the element has an attribute with the given name. + + Retrieve the first "address" element and the "hasAttribute()" method + should return true since the element has "domestic" as an attribute. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 +*/ +function hasAttribute04() { + var success; + if(checkInitialization(builder, "hasAttribute04") != null) return; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(0); + state = testNode.hasAttribute("dmstc:domestic"); + assertTrue("hasDomesticAttr",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttribute04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.html new file mode 100644 index 0000000000..182b102a25 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS01.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/level2/core/hasAttributeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributeNS01'; + + +/** +* + + The "hasAttributeNS()" method for an Element should + return false if the element does not have an attribute with the given local name + and/or a namespace URI specified on this element or does not have a default value. + + Retrieve the first "address" element and the "hasAttributeNS()" method + should return false since the element has "nomatch" as the local name + and "http://www.usa.com" as the namespace URI. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function hasAttributeNS01() { + var success; + if(checkInitialization(builder, "hasAttributeNS01") != null) return; + var localName = "nomatch"; + var namespaceURI = "http://www.usa.com"; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(0); + state = testNode.hasAttributeNS(namespaceURI,localName); + assertFalse("throw_False",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.html new file mode 100644 index 0000000000..e3222ca86a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS02.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/level2/core/hasAttributeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributeNS02'; + + +/** +* + The "hasAttributeNS()" method for an Element should + return false if the element does not have an attribute with the given local name + and/or namespace URI specified on this element or does not have a default value. + + Retrieve the first "address" element and the "hasAttributeNS()" method + should return false since the element has "domestic" as the local name + and "http://www.nomatch.com" as the namespace URI. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function hasAttributeNS02() { + var success; + if(checkInitialization(builder, "hasAttributeNS02") != null) return; + var localName = "domestic"; + var namespaceURI = "http://www.nomatch.com"; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(0); + state = testNode.hasAttributeNS(namespaceURI,localName); + assertFalse("throw_False",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.html new file mode 100644 index 0000000000..45bebc2c61 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS03.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/level2/core/hasAttributeNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributeNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributeNS03'; + + +/** +* + The "hasAttributeNS()" method for an Element should + return false if the element does not have an attribute with the given local name + and/or namespace URI specified on this element or does not have a default value. + + Retrieve the first "emp:address" element. + The boolean value returned by the "hasAttributeNS()" should be false + since the attribute does not have a default value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function hasAttributeNS03() { + var success; + if(checkInitialization(builder, "hasAttributeNS03") != null) return; + var localName = "blank"; + var namespaceURI = "http://www.nist.gov"; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testNode = elementList.item(0); + assertNotNull("empAddrNotNull",testNode); +state = testNode.hasAttributeNS(namespaceURI,localName); + assertFalse("throw_False",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.html new file mode 100644 index 0000000000..a811705656 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS04.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/level2/core/hasAttributeNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributeNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributeNS04'; + + +/** +* + The "hasAttributeNS()" method for an Element should + return true if the attribute with the given local name + and namespace URI has a default value. + + Retrieve the first "emp:address" element. + The boolean value returned by the "hasAttributeNS()" should be true + since the attribute has a default value. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function hasAttributeNS04() { + var success; + if(checkInitialization(builder, "hasAttributeNS04") != null) return; + var localName = "district"; + var namespaceURI = "http://www.nist.gov"; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testNode = elementList.item(0); + assertNotNull("empAddressNotNull",testNode); +state = testNode.hasAttributeNS(namespaceURI,localName); + assertTrue("hasAttribute",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.html new file mode 100644 index 0000000000..1312958f87 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributeNS05.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/level2/core/hasAttributeNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributeNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributeNS05'; + + +/** +* + The "hasAttributeNS()" method for an Element should + return true if the element has an attribute with the given local name + and the namespace URI is specified on this element or has a default value. + + Retrieve the first "address" element and the "hasAttributeNS()" method + should return true since the element has "domestic" as the local name + and "http://www.usa.com" as the namespace URI. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS +*/ +function hasAttributeNS05() { + var success; + if(checkInitialization(builder, "hasAttributeNS05") != null) return; + var localName = "domestic"; + var namespaceURI = "http://www.usa.com"; + var doc; + var elementList; + var testNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testNode = elementList.item(0); + state = testNode.hasAttributeNS(namespaceURI,localName); + assertTrue("hasAttribute",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributeNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html new file mode 100644 index 0000000000..dce45f6536 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributes01.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributes01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributes01'; + + +/** +* + The "hasAttributes()" method for a node should + return false if the node does not have an attribute. + + Retrieve the first "name" node and invoke the "hasAttributes()" method. + The method should return false since the node does not have an attribute. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function hasAttributes01() { + var success; + if(checkInitialization(builder, "hasAttributes01") != null) return; + var doc; + var addrList; + var addrNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addrList = doc.getElementsByTagName("name"); + addrNode = addrList.item(0); + state = addrNode.hasAttributes(); + assertFalse("throw_False",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html b/dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html new file mode 100644 index 0000000000..b560093d0b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hasAttributes02.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['hasAttributes02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'hasAttributes02'; + + +/** +* + The "hasAttributes()" method for a node should + return true if the node has attributes. + + Retrieve the first address node and the "hasAttributes()" method + should return true since the node has "domestic" as an attribute. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function hasAttributes02() { + var success; + if(checkInitialization(builder, "hasAttributes02") != null) return; + var doc; + var addrList; + var addrNode; + var state; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + addrList = doc.getElementsByTagName("address"); + addrNode = addrList.item(0); + state = addrNode.hasAttributes(); + assertTrue("throw_True",state); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hasAttributes02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.html b/dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.html new file mode 100644 index 0000000000..264368712a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hc_namednodemapinvalidtype1.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/level2/core/hc_namednodemapinvalidtype1</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/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_namednodemapinvalidtype1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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_namednodemapinvalidtype1'; + + +/** +* +Attempt to insert an element into an attribute list, +should raise a HIERARCHY_REQUEST_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='HIERARCHY_REQUEST_ERR']) +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 +* @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-4 +*/ +function hc_namednodemapinvalidtype1() { + var success; + if(checkInitialization(builder, "hc_namednodemapinvalidtype1") != null) return; + var doc; + var attributes; + var docElem; + var newElem; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docElem = doc.documentElement; + + attributes = docElem.attributes; + + newElem = doc.createElement("html"); + + { + success = false; + try { + retval = attributes.setNamedItem(newElem); + } + 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/level2/core/hc_namednodemapinvalidtype1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +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-level2-core/test_hc_nodedocumentfragmentnormalize1.html b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize1.html new file mode 100644 index 0000000000..555523609f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize1.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/level2/core/hc_nodedocumentfragmentnormalize1</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/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_nodedocumentfragmentnormalize1']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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_nodedocumentfragmentnormalize1'; + + +/** +* +Create a document fragment with two adjacent text nodes, normalize and see if the text nodes +were combined. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-B63ED1A3 +*/ +function hc_nodedocumentfragmentnormalize1() { + var success; + if(checkInitialization(builder, "hc_nodedocumentfragmentnormalize1") != null) return; + var doc; + var docFragment; + var nodeValue; + var txtNode; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docFragment = doc.createDocumentFragment(); + txtNode = doc.createTextNode("foo"); + retval = docFragment.appendChild(txtNode); + txtNode = doc.createTextNode("bar"); + retval = docFragment.appendChild(txtNode); + docFragment.normalize(); + txtNode = docFragment.firstChild; + + nodeValue = txtNode.nodeValue; + + assertEquals("normalizedNodeValue","foobar",nodeValue); + retval = txtNode.nextSibling; + + assertNull("singleChild",retval); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize1</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +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-level2-core/test_hc_nodedocumentfragmentnormalize2.html b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize2.html new file mode 100644 index 0000000000..360be4a2d7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_hc_nodedocumentfragmentnormalize2.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/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_nodedocumentfragmentnormalize2']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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_nodedocumentfragmentnormalize2'; + + +/** +* +Create a document fragment with an empty text node, after normalization there should be no child nodes. +were combined. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-B63ED1A3 +*/ +function hc_nodedocumentfragmentnormalize2() { + var success; + if(checkInitialization(builder, "hc_nodedocumentfragmentnormalize2") != null) return; + var doc; + var docFragment; + var nodeValue; + var txtNode; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docFragment = doc.createDocumentFragment(); + txtNode = doc.createTextNode(""); + retval = docFragment.appendChild(txtNode); + docFragment.normalize(); + txtNode = docFragment.firstChild; + + assertNull("noChild",txtNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +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-level2-core/test_importNode01.html b/dom/tests/mochitest/dom-level2-core/test_importNode01.html new file mode 100644 index 0000000000..182f246f1c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode01.html @@ -0,0 +1,181 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode01'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Attr. + The ownerElement is set to null. Specified flag is set to true. + Children is imported. + + Create a new attribute whose name is "elem:attr1" in a different document. + Create a child Text node with value "importedText" for the attribute node above. + Invoke method importNode(importedNode,deep) on this document with + importedNode being the newly created attribute. + Method should return a node whose name matches "elem:attr1" and a child node + whose value equals "importedText". + The returned node should belong to this document whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode01() { + var success; + if(checkInitialization(builder, "importNode01") != null) return; + var doc; + var aNewDoc; + var newAttr; + var importedChild; + var aNode; + var ownerDocument; + var attrOwnerElement; + var docType; + var system; + var specified; + var childList; + var nodeName; + var child; + var childValue; + var result = new Array(); + + expectedResult = new Array(); + expectedResult[0] = "elem:attr1"; + expectedResult[1] = "importedText"; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + newAttr = aNewDoc.createAttribute("elem:attr1"); + importedChild = aNewDoc.createTextNode("importedText"); + aNode = newAttr.appendChild(importedChild); + aNode = doc.importNode(newAttr,false); + ownerDocument = aNode.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertNotNull("aNode",aNode); +assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +attrOwnerElement = aNode.ownerElement; + + assertNull("ownerElement",attrOwnerElement); + specified = aNode.specified; + + assertTrue("specified",specified); +childList = aNode.childNodes; + + assertSize("childList",1,childList); +nodeName = aNode.nodeName; + + assertEquals("nodeName","elem:attr1",nodeName); + child = aNode.firstChild; + + childValue = child.nodeValue; + + assertEquals("childValue","importedText",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode02.html b/dom/tests/mochitest/dom-level2-core/test_importNode02.html new file mode 100644 index 0000000000..a2b4d0db3f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode02.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/level2/core/importNode02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode02'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type CData_Section. + + Create a CDATASection node with value being the string "this is CDATASection data" in + a different document. Invoke method importNode(importedNode,deep) on + this document. Method should return a CDATASection node whose value matches + the above string. The returned node should belong to this document whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode02() { + var success; + if(checkInitialization(builder, "importNode02") != null) return; + var doc; + var aNewDoc; + var cDataSec; + var aNode; + var ownerDocument; + var docType; + var system; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + cDataSec = aNewDoc.createCDATASection("this is CDATASection data"); + aNode = doc.importNode(cDataSec,false); + ownerDocument = aNode.ownerDocument; + + assertNotNull("ownerDocumentNotNull",ownerDocument); +docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("dtdSystemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +value = aNode.nodeValue; + + assertEquals("nodeValue","this is CDATASection data",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode03.html b/dom/tests/mochitest/dom-level2-core/test_importNode03.html new file mode 100644 index 0000000000..3940825641 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode03.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/level2/core/importNode03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode03'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Comment. + + Create a comment node with value being the string "this is a comment" in + a different document. Invoke method importNode(importedNode,deep) on + this document. Method should return a comment node whose value matches + the above string. The returned node should belong to this document whose + systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode03() { + var success; + if(checkInitialization(builder, "importNode03") != null) return; + var doc; + var aNewDoc; + var comment; + var aNode; + var ownerDocument; + var docType; + var system; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + comment = aNewDoc.createComment("this is a comment"); + aNode = doc.importNode(comment,false); + ownerDocument = aNode.ownerDocument; + + assertNotNull("ownerDocumentNotNull",ownerDocument); +docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +value = aNode.nodeValue; + + assertEquals("nodeValue","this is a comment",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode04.html b/dom/tests/mochitest/dom-level2-core/test_importNode04.html new file mode 100644 index 0000000000..6cb677d903 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode04.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/level2/core/importNode04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "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 = 'importNode04'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Document_Fragment. + + Create a DocumentFragment in a different document. + Create a Comment child node for the Document Fragment. + Invoke method importNode(importedNode,deep) on this document + with importedNode being the newly created DocumentFragment. + Method should return a node of type DocumentFragment whose child has + comment value "descendant1". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode04() { + var success; + if(checkInitialization(builder, "importNode04") != null) return; + var doc; + var aNewDoc; + var docFrag; + var comment; + var aNode; + var children; + var child; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staff"); + docFrag = aNewDoc.createDocumentFragment(); + comment = aNewDoc.createComment("descendant1"); + aNode = docFrag.appendChild(comment); + aNode = doc.importNode(docFrag,true); + children = aNode.childNodes; + + assertSize("throw_Size",1,children); +child = aNode.firstChild; + + childValue = child.nodeValue; + + assertEquals("descendant1","descendant1",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode05.html b/dom/tests/mochitest/dom-level2-core/test_importNode05.html new file mode 100644 index 0000000000..b03589cd17 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode05.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/level2/core/importNode05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode05'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Element. + + Retrieve element "emp:address" from staffNS.xml document. + Invoke method importNode(importedNode,deep) on this document + with importedNode being the element from above and deep is false. + Method should return an element node whose name matches "emp:address" + and whose children are not imported. The returned node should + belong to this document whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode05() { + var success; + if(checkInitialization(builder, "importNode05") != null) return; + var doc; + var aNewDoc; + var element; + var aNode; + var hasChild; + var ownerDocument; + var docType; + var system; + var name; + var addresses; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + addresses = aNewDoc.getElementsByTagName("emp:address"); + element = addresses.item(0); + assertNotNull("empAddressNotNull",element); +aNode = doc.importNode(element,false); + hasChild = aNode.hasChildNodes(); + assertFalse("hasChild",hasChild); +ownerDocument = aNode.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("dtdSystemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +name = aNode.nodeName; + + assertEquals("nodeName","emp:address",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode06.html b/dom/tests/mochitest/dom-level2-core/test_importNode06.html new file mode 100644 index 0000000000..cd6223b2bf --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode06.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/level2/core/importNode06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode06'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Element. + + Retrieve element "emp:address" from staffNS.xml document. + Invoke method importNode(importedNode,deep) on this document + with importedNode being the element from above and deep is true. + Method should return an element node whose name matches "emp:address" and + whose descendant is imported. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode06() { + var success; + if(checkInitialization(builder, "importNode06") != null) return; + var doc; + var aNewDoc; + var element; + var aNode; + var hasChild; + var name; + var child; + var value; + var addresses; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + addresses = aNewDoc.getElementsByTagName("emp:address"); + element = addresses.item(0); + assertNotNull("empAddressNotNull",element); +aNode = doc.importNode(element,true); + hasChild = aNode.hasChildNodes(); + assertTrue("throw_True",hasChild); +name = aNode.nodeName; + + assertEquals("nodeName","emp:address",name); + child = aNode.firstChild; + + value = child.nodeValue; + + assertEquals("nodeValue","27 South Road. Dallas, texas 98556",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode07.html b/dom/tests/mochitest/dom-level2-core/test_importNode07.html new file mode 100644 index 0000000000..d514e6ff42 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode07.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/level2/core/importNode07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "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 = 'importNode07'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Element. + If this document defines default attributes for this element name (importedNode), + those default attributes are assigned. + + Create an element whose name is "emp:employee" in a different document. + Invoke method importNode(importedNode,deep) on this document which + defines default attribute for the element name "emp:employee". + Method should return an the imported element with an assigned default attribute. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 +*/ +function importNode07() { + var success; + if(checkInitialization(builder, "importNode07") != null) return; + var doc; + var aNewDoc; + var element; + var aNode; + var attributes; + var name; + var attr; + var lname; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "emp:employee"; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staff"); + element = aNewDoc.createElementNS(namespaceURI,qualifiedName); + aNode = doc.importNode(element,false); + attributes = aNode.attributes; + + assertSize("throw_Size",1,attributes); +name = aNode.nodeName; + + assertEquals("nodeName","emp:employee",name); + attr = attributes.item(0); + lname = attr.localName; + + assertEquals("lname","defaultAttr",lname); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode08.html b/dom/tests/mochitest/dom-level2-core/test_importNode08.html new file mode 100644 index 0000000000..fdc9ca283b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode08.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/level2/core/importNode08</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode08'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Document_Fragment. + + Create a DocumentFragment in a different document. + Invoke method importNode(importedNode,deep) on this document + with importedNode being the newly created DocumentFragment. + Method should return an empty DocumentFragment that belongs + to this document whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId +*/ +function importNode08() { + var success; + if(checkInitialization(builder, "importNode08") != null) return; + var doc; + var aNewDoc; + var docFrag; + var aNode; + var hasChild; + var ownerDocument; + var docType; + var system; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + docFrag = aNewDoc.createDocumentFragment(); + aNode = doc.importNode(docFrag,false); + hasChild = aNode.hasChildNodes(); + assertFalse("hasChild",hasChild); +ownerDocument = aNode.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("system",null,null,null,"staffNS.dtd",null,null,null,null,system); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode09.html b/dom/tests/mochitest/dom-level2-core/test_importNode09.html new file mode 100644 index 0000000000..739c4a2de5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode09.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/level2/core/importNode09</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode09'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Entity. + + Retrieve entity "ent6" from staffNS.xml document. + Invoke method importNode(importedNode,deep) on this document. + Method should return a node of type Entity whose publicId, systemId and + notationName attributes are copied. + The returned node should belong to this document whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode09() { + var success; + if(checkInitialization(builder, "importNode09") != null) return; + var doc; + var aNewDoc; + var doc1Type; + var entityList; + var entity2; + var entity1; + var ownerDocument; + var docType; + var system; + var entityName; + var publicVal; + var notationName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + docType = aNewDoc.doctype; + + entityList = docType.entities; + + assertNotNull("entitiesNotNull",entityList); +entity2 = entityList.getNamedItem("ent6"); + entity1 = doc.importNode(entity2,false); + ownerDocument = entity1.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("dtdSystemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +entityName = entity1.nodeName; + + assertEquals("entityName","ent6",entityName); + publicVal = entity1.publicId; + + assertEquals("entityPublicId","uri",publicVal); + system = entity1.systemId; + + assertURIEquals("entitySystemId",null,null,null,"file",null,null,null,null,system); +notationName = entity1.notationName; + + assertEquals("notationName","notation2",notationName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode10.html b/dom/tests/mochitest/dom-level2-core/test_importNode10.html new file mode 100644 index 0000000000..d209214e58 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode10.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/level2/core/importNode10</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode10']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode10'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Entity_Reference. + Only the EntityReference is copied, regardless of deep's value. + + Create an entity reference whose name is "entRef1" in a different document. + Give it value "entRef1Value". + Invoke method importNode(importedNode,deep) on this document with importedNode + being "entRef1". + Method should return a node of type Entity_Reference (whose value is null) that + belongs to this document whose systemId is "staff.dtd". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode10() { + var success; + if(checkInitialization(builder, "importNode10") != null) return; + var doc; + var aNewDoc; + var entRef; + var aNode; + var ownerDocument; + var docType; + var system; + var name; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + entRef = aNewDoc.createEntityReference("entRef1"); + assertNotNull("createdEntRefNotNull",entRef); +entRef.nodeValue = "entRef1Value"; + + aNode = doc.importNode(entRef,false); + ownerDocument = aNode.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +name = aNode.nodeName; + + assertEquals("nodeName","entRef1",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode10</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode11.html b/dom/tests/mochitest/dom-level2-core/test_importNode11.html new file mode 100644 index 0000000000..d1f4727ff0 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode11.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/level2/core/importNode11</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode11']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "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 = 'importNode11'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Entity_Reference. + Only the EntityReference is copied, regardless of deep's value. + If the Document provides a definition for the entity name, its value is assigned. + + Create an entity reference whose name is "ent3" in a different document. + Invoke method importNode(importedNode,deep) on this document with importedNode + being "ent3". + Method should return a node of type Entity_Reference whose first child's value is "Texas" as defined + in this document. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode11() { + var success; + if(checkInitialization(builder, "importNode11") != null) return; + var doc; + var aNewDoc; + var entRef; + var aNode; + var name; + var child; + var childValue; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staff"); + entRef = aNewDoc.createEntityReference("ent3"); + assertNotNull("createdEntRefNotNull",entRef); +aNode = doc.importNode(entRef,true); + name = aNode.nodeName; + + assertEquals("entityName","ent3",name); + child = aNode.firstChild; + + assertNotNull("child",child); +childValue = child.nodeValue; + + assertEquals("childValue","Texas",childValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode11</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode12.html b/dom/tests/mochitest/dom-level2-core/test_importNode12.html new file mode 100644 index 0000000000..797b1191a4 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode12.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/level2/core/importNode12</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode12']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode12'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Entity. + + Retrieve entity "ent4" from staffNS.xml document. + Invoke method importNode(importedNode,deep) on this document with deep as false. + Method should return a node of type Entity whose descendant is copied. + The returned node should belong to this document whose systemId is "staffNS.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode12() { + var success; + if(checkInitialization(builder, "importNode12") != null) return; + var doc; + var aNewDoc; + var doc1Type; + var entityList; + var entity2; + var entity1; + var ownerDocument; + var docType; + var system; + var entityName; + var child; + var childName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + doc1Type = aNewDoc.doctype; + + entityList = doc1Type.entities; + + assertNotNull("entitiesNotNull",entityList); +entity2 = entityList.getNamedItem("ent4"); + entity1 = doc.importNode(entity2,true); + ownerDocument = entity1.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +entityName = entity1.nodeName; + + assertEquals("entityName","ent4",entityName); + child = entity1.firstChild; + + assertNotNull("notnull",child); +childName = child.nodeName; + + assertEquals("childName","entElement1",childName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode12</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode13.html b/dom/tests/mochitest/dom-level2-core/test_importNode13.html new file mode 100644 index 0000000000..2b217c8c46 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode13.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/level2/core/importNode13</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode13']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode13'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Notation. + + Retrieve notation named "notation1" from document staffNS.xml. + Invoke method importNode(importedNode,deep) where importedNode + contains the retrieved notation and deep is false. Method should + return a node of type notation whose name is "notation1". + The returned node should belong to this document whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode13() { + var success; + if(checkInitialization(builder, "importNode13") != null) return; + var doc; + var aNewDoc; + var doc1Type; + var notationList; + var notation; + var aNode; + var ownerDocument; + var docType; + var system; + var publicVal; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + doc1Type = aNewDoc.doctype; + + notationList = doc1Type.notations; + + assertNotNull("notationsNotNull",notationList); +notation = notationList.getNamedItem("notation1"); + aNode = doc.importNode(notation,false); + ownerDocument = aNode.ownerDocument; + + docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +publicVal = aNode.publicId; + + assertEquals("publicId","notation1File",publicVal); + system = aNode.systemId; + + assertNull("notationSystemId",system); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode13</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode14.html b/dom/tests/mochitest/dom-level2-core/test_importNode14.html new file mode 100644 index 0000000000..f58e7827d7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode14.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/level2/core/importNode14</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode14']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode14'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Processing Instruction. + + Create a processing instruction with target as "target1" and data as "data1" + in a different document. Invoke method importNode(importedNode,deep) on this document. + Method should return a processing instruction whose target and data match the given + parameters. The returned PI should belong to this document whose systemId is "staff.dtd". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode14() { + var success; + if(checkInitialization(builder, "importNode14") != null) return; + var doc; + var aNewDoc; + var pi; + var aNode; + var ownerDocument; + var docType; + var system; + var target; + var data; + var result = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + pi = aNewDoc.createProcessingInstruction("target1","data1"); + aNode = doc.importNode(pi,false); + ownerDocument = aNode.ownerDocument; + + assertNotNull("ownerDocumentNotNull",ownerDocument); +docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +target = aNode.target; + + assertEquals("piTarget","target1",target); + data = aNode.data; + + assertEquals("piData","data1",data); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode14</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode15.html b/dom/tests/mochitest/dom-level2-core/test_importNode15.html new file mode 100644 index 0000000000..35c8c5a49c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode15.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/level2/core/importNode15</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode15']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + docsLoaded += preload(aNewDocRef, "aNewDoc", "staffNS"); + + 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 = 'importNode15'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should import the given importedNode into that Document. + The importedNode is of type Text. + + Create a text node with value being the string "this is text data" in + a different document. Invoke method importNode(importedNode,deep) on + this document. Method should return a text node whose value matches + the above string. The returned node should belong to this document + whose systemId is "staff.dtd" + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +*/ +function importNode15() { + var success; + if(checkInitialization(builder, "importNode15") != null) return; + var doc; + var aNewDoc; + var text; + var aNode; + var ownerDocument; + var docType; + var system; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var aNewDocRef = null; + if (typeof(this.aNewDoc) != 'undefined') { + aNewDocRef = this.aNewDoc; + } + aNewDoc = load(aNewDocRef, "aNewDoc", "staffNS"); + text = aNewDoc.createTextNode("this is text data"); + aNode = doc.importNode(text,false); + ownerDocument = aNode.ownerDocument; + + assertNotNull("ownerDocumentNotNull",ownerDocument); +docType = ownerDocument.doctype; + + system = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system); +value = aNode.nodeValue; + + assertEquals("nodeValue","this is text data",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode15</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode16.html b/dom/tests/mochitest/dom-level2-core/test_importNode16.html new file mode 100644 index 0000000000..412acbefb0 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode16.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/level2/core/importNode16</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode16']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var anotherDocRef = null; + if (typeof(this.anotherDoc) != 'undefined') { + anotherDocRef = this.anotherDoc; + } + docsLoaded += preload(anotherDocRef, "anotherDoc", "staffNS"); + + 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 = 'importNode16'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should raise NOT_SUPPORTED_ERR DOMException if + the type of node being imported is DocumentType. + + The specification has changed! No exception should be thrown. + + Retrieve document staff.xml and get its type. + Invoke method importNode(importedNode,deep) where importedNode + contains the document type of the staff.xml. + Method should raise NOT_SUPPORT_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_SUPPORTED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Core-Document-importNode')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_SUPPORTED_ERR']) +*/ +function importNode16() { + var success; + if(checkInitialization(builder, "importNode16") != null) return; + var doc; + var anotherDoc; + var docType; + var node; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var anotherDocRef = null; + if (typeof(this.anotherDoc) != 'undefined') { + anotherDocRef = this.anotherDoc; + } + anotherDoc = load(anotherDocRef, "anotherDoc", "staffNS"); + docType = anotherDoc.doctype; + + + { + success = false; + try { + node = doc.importNode(docType,false); + success = true; + } + catch(ex) { + success = false; + } + assertTrue("no_throw_NOT_SUPPORTED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode16</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_importNode17.html b/dom/tests/mochitest/dom-level2-core/test_importNode17.html new file mode 100644 index 0000000000..b52c7ddce3 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_importNode17.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/level2/core/importNode17</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['importNode17']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var anotherDocRef = null; + if (typeof(this.anotherDoc) != 'undefined') { + anotherDocRef = this.anotherDoc; + } + docsLoaded += preload(anotherDocRef, "anotherDoc", "staffNS"); + + 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 = 'importNode17'; + + +/** +* + The "importNode(importedNode,deep)" method for a + Document should raise NOT_SUPPORTED_ERR DOMException if + the type of node being imported is Document. + + Retrieve staff.xml document. + Invoke method importNode(importedNode,deep) where importedNode + contains staff.xml and deep is true. + Method should raise NOT_SUPPORTED_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_SUPPORTED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Core-Document-importNode')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_SUPPORTED_ERR']) +*/ +function importNode17() { + var success; + if(checkInitialization(builder, "importNode17") != null) return; + var doc; + var anotherDoc; + var node; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var anotherDocRef = null; + if (typeof(this.anotherDoc) != 'undefined') { + anotherDocRef = this.anotherDoc; + } + anotherDoc = load(anotherDocRef, "anotherDoc", "staffNS"); + + { + success = false; + try { + node = doc.importNode(anotherDoc,false); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 9); + } + assertTrue("throw_NOT_SUPPORTED_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode17</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_localName01.html b/dom/tests/mochitest/dom-level2-core/test_localName01.html new file mode 100644 index 0000000000..738417e3cd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_localName01.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/level2/core/localName01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['localName01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'localName01'; + + +/** +* + The "getLocalName()" method for a Node + returns the local part of the qualified name of this node, + and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE + and nodes created with a DOM Level 1 method, this is null. + + Retrieve the first emp:address node and get the attributes of this node." + Then apply the getLocalName() method to the emp:domestic attribute. + The method should return "domestic". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN +*/ +function localName01() { + var success; + if(checkInitialization(builder, "localName01") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var localName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +addrAttr = testAddr.getAttributeNode("emp:domestic"); + localName = addrAttr.localName; + + assertEquals("localName","domestic",localName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_localName02.html b/dom/tests/mochitest/dom-level2-core/test_localName02.html new file mode 100644 index 0000000000..a3cad6eb54 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_localName02.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/level2/core/localName02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['localName02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'localName02'; + + +/** +* + The "getLocalName()" method for a Node + returns the local part of the qualified name of this node, + and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE + and nodes created with a DOM Level 1 method, this is null. + + Create an new Element with the createElement() method. + Invoke the "getLocalName()" method on the newly created element + node will cause "null" to be returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN +*/ +function localName02() { + var success; + if(checkInitialization(builder, "localName02") != null) return; + var doc; + var createdNode; + var localName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + createdNode = doc.createElement("test:employee"); + localName = createdNode.localName; + + assertNull("localNameNull",localName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_localName04.html b/dom/tests/mochitest/dom-level2-core/test_localName04.html new file mode 100644 index 0000000000..c414e24b4b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_localName04.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/level2/core/localName04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['localName04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'localName04'; + + +/** +* + The "getLocalName()" method for a Node + returns the local part of the qualified name of this node, + and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE + and nodes created with a DOM Level 1 method, this is null. + + Retrieve the first employee node and invoke the "getLocalName()" + method. The method should return "employee". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN +*/ +function localName04() { + var success; + if(checkInitialization(builder, "localName04") != null) return; + var doc; + var elementList; + var testEmployee; + var employeeLocalName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testEmployee = elementList.item(0); + employeeLocalName = testEmployee.localName; + + assertEquals("lname","employee",employeeLocalName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/localName04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.html new file mode 100644 index 0000000000..c7076accd8 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns01.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/level2/core/namednodemapgetnameditemns01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditemns01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditemns01'; + + +/** +* + Using the method getNamedItemNS, retreive the entity "ent1" and notation "notation1" + from a NamedNodeMap of this DocumentTypes entities and notations. + Both should be null since entities and notations are not namespaced. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=407 +* @see http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html +*/ +function namednodemapgetnameditemns01() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditemns01") != null) return; + var doc; + var docType; + var entities; + var notations; + var entity; + var notation; + var entityName; + var notationName; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +entity = entities.getNamedItemNS(nullNS,"ent1"); + assertNull("entityNull",entity); + notation = notations.getNamedItemNS(nullNS,"notation1"); + assertNull("notationNull",notation); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.html new file mode 100644 index 0000000000..845518c92d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns02.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/level2/core/namednodemapgetnameditemns02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditemns02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditemns02'; + + +/** +* + The method getNamedItemNS retrieves a node specified by local name and namespace URI. + + Using the method getNamedItemNS, retreive an attribute node having namespaceURI=http://www.nist.gov + and localName=domestic, from a NamedNodeMap of attribute nodes, for the second element + whose namespaceURI=http://www.nist.gov and localName=address. Verify if the attr node + has been retreived successfully by checking its nodeName atttribute. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function namednodemapgetnameditemns02() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditemns02") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(1); + attributes = element.attributes; + + attribute = attributes.getNamedItemNS("http://www.nist.gov","domestic"); + attrName = attribute.nodeName; + + assertEquals("namednodemapgetnameditemns02","emp:domestic",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.html new file mode 100644 index 0000000000..8332b351fe --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns03.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/level2/core/namednodemapgetnameditemns03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditemns03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditemns03'; + + +/** +* + The method getNamedItemNS retrieves a node specified by local name and namespace URI. + + Create a new Element node and add 2 new attribute nodes having the same local name but different + namespace names and namespace prefixes to it. Using the getNamedItemNS retreive the second attribute node. + Verify if the attr node has been retreived successfully by checking its nodeName atttribute. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function namednodemapgetnameditemns03() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditemns03") != null) return; + var doc; + var attributes; + var element; + var attribute; + var newAttr1; + var newAttr2; + var newAttribute; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test","root"); + newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); + newAttribute = element.setAttributeNodeNS(newAttr1); + newAttr2 = doc.createAttributeNS("http://www.w3.org/DOM/L2","L2:att"); + newAttribute = element.setAttributeNodeNS(newAttr2); + attributes = element.attributes; + + attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L2","att"); + attrName = attribute.nodeName; + + assertEquals("namednodemapgetnameditemns03","L2:att",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.html new file mode 100644 index 0000000000..61f19562d6 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns04.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/level2/core/namednodemapgetnameditemns04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditemns04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditemns04'; + + +/** +* + The method getNamedItemNS retrieves a node specified by local name and namespace URI. + + Retreive the second address element node having localName=adrress. + Create a new attribute node having the same name as an existing node but different namespaceURI + and add it to this element. Using the getNamedItemNS retreive the newly created attribute + node from a nodemap of attributes of the retreive element node. + Verify if the attr node has been retreived successfully by checking its nodeName atttribute. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function namednodemapgetnameditemns04() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditemns04") != null) return; + var doc; + var attributes; + var element; + var attribute; + var newAttr1; + var newAttribute; + var elementList; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(1); + newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","street"); + newAttribute = element.setAttributeNodeNS(newAttr1); + attributes = element.attributes; + + attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","street"); + attrName = attribute.nodeName; + + assertEquals("namednodemapgetnameditemns04","street",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.html new file mode 100644 index 0000000000..f6ccb847f2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns05.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/level2/core/namednodemapgetnameditemns05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditemns05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditemns05'; + + +/** +* + The method getNamedItemNS retrieves a node specified by local name and namespace URI. + + Retreieve the second address element and its attribute into a named node map. + Try retreiving the street attribute from the namednodemap using the + default namespace uri and the street attribute name. Since the default + namespace doesnot apply to attributes this should return null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function namednodemapgetnameditemns05() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditemns05") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(1); + attributes = element.attributes; + + attribute = attributes.getNamedItemNS("*","street"); + assertNull("namednodemapgetnameditemns05",attribute); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.html new file mode 100644 index 0000000000..5e06946c1e --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapgetnameditemns06.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/level2/core/namednodemapgetnameditemns06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapgetnameditemns06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapgetnameditemns06'; + + +/** +* + Retreive the second address element node having localName=adrress. Retreive the attributes + of this element into 2 nodemaps. Create a new attribute node and add it to this element. + Since NamedNodeMaps are live each one should get updated, using the getNamedItemNS retreive + the newly created attribute from each node map. + Verify if the attr node has been retreived successfully by checking its nodeName atttribute. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function namednodemapgetnameditemns06() { + var success; + if(checkInitialization(builder, "namednodemapgetnameditemns06") != null) return; + var doc; + var attributesMap1; + var attributesMap2; + var element; + var attribute; + var newAttr1; + var newAttribute; + var elementList; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(1); + attributesMap1 = element.attributes; + + attributesMap2 = element.attributes; + + newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","street"); + newAttribute = element.setAttributeNodeNS(newAttr1); + attribute = attributesMap1.getNamedItemNS("http://www.w3.org/DOM/L1","street"); + attrName = attribute.nodeName; + + assertEquals("namednodemapgetnameditemnsMap106","street",attrName); + attribute = attributesMap2.getNamedItemNS("http://www.w3.org/DOM/L1","street"); + attrName = attribute.nodeName; + + assertEquals("namednodemapgetnameditemnsMap206","street",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.html new file mode 100644 index 0000000000..e3b8cd8e88 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns01.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/level2/core/namednodemapremovenameditemns01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns01'; + + +/** +* + The method removeNamedItemNS removes a node specified by local name and namespace + + Retreive an attribute node and then remove from the NamedNodeMap. Verify if the attribute + node was actually remove from the node map. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns01() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns01") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(1); + attributes = element.attributes; + + attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); + attribute = attributes.getNamedItemNS("http://www.nist.gov","domestic"); + assertNull("namednodemapremovenameditemns01",attribute); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.html new file mode 100644 index 0000000000..a15582cd15 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns02.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/level2/core/namednodemapremovenameditemns02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns02'; + + +/** +* + The method removeNamedItemNS removes a node specified by local name and namespace + A removed attribute may be known to have a default value when this map contains the + attributes attached to an element, as returned by the attributes attribute of the Node + interface. If so, an attribute immediately appears containing the default value as well + as the corresponding namespace URI, local name, and prefix when applicable. + + Retreive a default attribute node. Remove it from the NodeMap. Check if a new one immediately + appears containing the default value. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function namednodemapremovenameditemns02() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns02") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + var attrValue; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = elementList.item(1); + attributes = element.attributes; + + attribute = attributes.removeNamedItemNS(nullNS,"defaultAttr"); + attribute = attributes.getNamedItemNS(nullNS,"defaultAttr"); + attrValue = attribute.nodeValue; + + assertNotNull("namednodemapremovenameditemns02",attribute); +assertEquals("namednodemapremovenameditemns02_attrValue","defaultVal",attrValue); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.html new file mode 100644 index 0000000000..e2c8486acb --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns03.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/level2/core/namednodemapremovenameditemns03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns03'; + + +/** +* + The method removeNamedItemNS removes a node specified by local name and namespace + + Create a new element node and add 2 new attribute nodes to it that have the same localName + but different namespaceURI's. Remove the first attribute node from the namedNodeMap of the + new element node and check to see that the second attribute still exists. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns03() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns03") != null) return; + var doc; + var attributes; + var element; + var attribute; + var newAttribute; + var attribute1; + var attribute2; + var nodeName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test","root"); + attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); + newAttribute = element.setAttributeNodeNS(attribute1); + attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/L2","L2:att"); + newAttribute = element.setAttributeNodeNS(attribute2); + attributes = element.attributes; + + attribute = attributes.removeNamedItemNS("http://www.w3.org/DOM/L1","att"); + attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L2","att"); + nodeName = attribute.nodeName; + + assertEquals("namednodemapremovenameditemns02","L2:att",nodeName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.html new file mode 100644 index 0000000000..b29dcffc5c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns04.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/level2/core/namednodemapremovenameditemns04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns04'; + + +/** +* + The method removeNamedItemNS removes a node specified by local name and namespace + + Attempt to remove the xmlns and dmstc attributes of the first element node with the localName + employee. Verify if the 2 attributes were successfully removed. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns04() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns04") != null) return; + var doc; + var attributes; + var element; + var attribute; + var attributeRemoved; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","employee"); + element = elementList.item(0); + attributes = element.attributes; + + attributeRemoved = attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/","xmlns"); + attribute = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/","xmlns"); + assertNull("namednodemapremovenameditemns04_1",attribute); + attributeRemoved = attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/","dmstc"); + attribute = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/","dmstc"); + assertNull("namednodemapremovenameditemns04_2",attribute); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.html new file mode 100644 index 0000000000..3f00f5d642 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns05.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/level2/core/namednodemapremovenameditemns05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns05'; + + +/** +* + Retreive an entity and notation node and remove the first notation from the + entity node map and first entity node from the notation map. Since both these + maps are readonly, a NO_MODIFICATION_ALLOWED_ERR should be raised. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=407 +* @see http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html +*/ +function namednodemapremovenameditemns05() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns05") != null) return; + var doc; + var docType; + var entities; + var notations; + var removedNode; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); + + try { + removedNode = entities.removeNamedItemNS(nullNS,"ent1"); + fail("entity_throw_DOMException"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* NOT_FOUND_ERR */ 8 : + break; + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + try { + removedNode = notations.removeNamedItemNS(nullNS,"notation1"); + fail("notation_throw_DOMException"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* NOT_FOUND_ERR */ 8 : + break; + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.html new file mode 100644 index 0000000000..ea40d0c931 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns06.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/level2/core/namednodemapremovenameditemns06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns06'; + + +/** +* + The method removeNamedItemNS removes a node using its namespaceURI and localName and + raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and + localName in this map + + Retreive an attribute node into a namednodemap. While removing it from the map specify + an incorrect namespaceURI. This should raise a NOT_FOUND_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns06() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns06") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = elementList.item(1); + attributes = element.attributes; + + + { + success = false; + try { + attribute = attributes.removeNamedItemNS("http://www.Nist.gov","domestic"); + } + 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/level2/core/namednodemapremovenameditemns06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.html new file mode 100644 index 0000000000..99a0cc083d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns07.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/level2/core/namednodemapremovenameditemns07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns07'; + + +/** +* + The method removeNamedItemNS removes a node using its namespaceURI and localName and + raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and + localName in this map + + Retreive an attribute node from a namednodemap. While removing it from the map specify + an incorrect localName. This should raise a NOT_FOUND_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns07() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns07") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); + element = elementList.item(1); + attributes = element.attributes; + + + { + success = false; + try { + attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); + } + 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/level2/core/namednodemapremovenameditemns07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.html new file mode 100644 index 0000000000..1e1448d42f --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns08.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/level2/core/namednodemapremovenameditemns08</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns08'; + + +/** +* + The method removeNamedItemNS removes a node using its namespaceURI and localName and + raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and + localName in this map + + Retreive an attribute node from a namednodemap. Remove the attribute node from the document + object. Since NamedNodeMaps are live it should also automatically get removed from + the node map. And so if an attempt is made to remove it using removeAttributeNS, this should + raise a NOT_FOUND_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns08() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns08") != null) return; + var doc; + var attributes; + var element; + var attribute; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(1); + attributes = element.attributes; + + element.removeAttributeNS("http://www.nist.gov","domestic"); + + { + success = false; + try { + attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); + } + 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/level2/core/namednodemapremovenameditemns08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.html new file mode 100644 index 0000000000..45ef833702 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapremovenameditemns09.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/level2/core/namednodemapremovenameditemns09</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapremovenameditemns09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapremovenameditemns09'; + + +/** +* + The method removeNamedItemNS removes a node using its namespaceURI and localName and + raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and + localName in this map + + Retreive an attribute node. Remove the attribute node from the node map. + Check the element object to ensure that the attribute node has been removed from it. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 +*/ +function namednodemapremovenameditemns09() { + var success; + if(checkInitialization(builder, "namednodemapremovenameditemns09") != null) return; + var doc; + var attributes; + var newAttributes; + var element; + var attribute; + var elementList; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(1); + attributes = element.attributes; + + attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); + newAttributes = element.attributes; + + attribute = newAttributes.getNamedItemNS("http://www.nist.gov","domestic"); + assertNull("namednodemapremovenameditemns09",attribute); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.html new file mode 100644 index 0000000000..84133fd9bf --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns01.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/level2/core/namednodemapsetnameditemns01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns01'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName. If a node with + that namespace URI and that local name is already present in this map, it is replaced + by the new one. + + Retreive the first element whose localName is address and namespaceURI http://www.nist.gov", + and put its attributes into a named node map. Create a new attribute node and add it to this map. + Verify if the attr node was successfully added by checking the nodeName of the retreived atttribute. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS +*/ +function namednodemapsetnameditemns01() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns01") != null) return; + var doc; + var attributes; + var element; + var attribute; + var newAttribute; + var newAttr1; + var elementList; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(0); + attributes = element.attributes; + + newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","streets"); + newAttribute = element.setAttributeNodeNS(newAttr1); + attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","streets"); + attrName = attribute.nodeName; + + assertEquals("namednodemapsetnameditemns01","streets",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.html new file mode 100644 index 0000000000..80eb42e37a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns02.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/level2/core/namednodemapsetnameditemns02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns02'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName. If a node with + that namespace URI and that local name is already present in this map, it is replaced + by the new one. + + Create a new element and attribute Node and add the newly created attribute node to the elements + NamedNodeMap. Verify if the new attr node has been successfully added to the map by checking + the nodeName of the retreived atttribute from the list of attribute nodes in this map. + + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function namednodemapsetnameditemns02() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns02") != null) return; + var doc; + var attributes; + var element; + var attribute; + var attribute1; + var newNode; + var attrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + element = doc.createElementNS("http://www.w3.org/DOM/Test","root"); + attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); + attributes = element.attributes; + + newNode = attributes.setNamedItemNS(attribute1); + attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","att"); + attrName = attribute.nodeName; + + assertEquals("namednodemapsetnameditemns02","L1:att",attrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.html new file mode 100644 index 0000000000..e711b7d38c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns03.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/level2/core/namednodemapsetnameditemns03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var docAltRef = null; + if (typeof(this.docAlt) != 'undefined') { + docAltRef = this.docAlt; + } + docsLoaded += preload(docAltRef, "docAlt", "staffNS"); + + 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 = 'namednodemapsetnameditemns03'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName and + raises a WRONG_DOCUMENT_ERR if arg was created from a different document than the + one that created this map. + + Retreieve the second element whose local name is address and its attribute into a named node map. + Do the same for another document and retreive its street attribute. Call the setNamedItemNS + using the first namedNodeMap and the retreive street attribute of the second. This should + raise a WRONG_DOCUMENT_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=408 +*/ +function namednodemapsetnameditemns03() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns03") != null) return; + var doc; + var docAlt; + var attributes; + var attributesAlt; + var elementList; + var elementListAlt; + var element; + var elementAlt; + var attr; + var newNode; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(1); + attributes = element.attributes; + + + var docAltRef = null; + if (typeof(this.docAlt) != 'undefined') { + docAltRef = this.docAlt; + } + docAlt = load(docAltRef, "docAlt", "staffNS"); + elementListAlt = docAlt.getElementsByTagNameNS("*","address"); + elementAlt = elementListAlt.item(1); + attributesAlt = elementAlt.attributes; + + attr = attributesAlt.getNamedItemNS(nullNS,"street"); + newNode = attributesAlt.removeNamedItemNS(nullNS,"street"); + + { + success = false; + try { + newNode = attributes.setNamedItemNS(attr); + } + 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/level2/core/namednodemapsetnameditemns03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.html new file mode 100644 index 0000000000..6fa313f5e8 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns04.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/level2/core/namednodemapsetnameditemns04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns04'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName and + raises a WRONG_DOCUMENT_ERR if arg was created from a different document than the + one that created this map. + + Retreieve the second element whose local name is address and its attribute into a named node map. + Create a new document and a new attribute node in it. Call the setNamedItemNS using the first + namedNodeMap and the new attribute node attribute of the new document. This should + raise a WRONG_DOCUMENT_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function namednodemapsetnameditemns04() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns04") != null) return; + var doc; + var domImpl; + var docAlt; + var docType = null; + + var attributes; + var elementList; + var element; + var attrAlt; + var newNode; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(1); + attributes = element.attributes; + + domImpl = doc.implementation; +docAlt = domImpl.createDocument(nullNS,"newDoc",docType); + attrAlt = docAlt.createAttributeNS(nullNS,"street"); + + { + success = false; + try { + newNode = attributes.setNamedItemNS(attrAlt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 4); + } + todo(success, "throw_WRONG_DOCUMENT_ERR"); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.html new file mode 100644 index 0000000000..07ba4904a1 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns05.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/level2/core/namednodemapsetnameditemns05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns05'; + + +/** +* + Retreive an entity and notation node and add the first notation to the + notation node map and first entity node to the entity map. Since both these + maps are for readonly node, a NO_MODIFICATION_ALLOWED_ERR should be raised. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=407 +* @see http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html +*/ +function namednodemapsetnameditemns05() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns05") != null) return; + var doc; + var docType; + var entities; + var notations; + var entity; + var notation; + var newNode; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +entity = entities.getNamedItem("ent1"); + notation = notations.getNamedItem("notation1"); + + { + success = false; + try { + newNode = entities.setNamedItemNS(entity); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities",success); + } + + { + success = false; + try { + newNode = notations.setNamedItemNS(notation); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.html new file mode 100644 index 0000000000..031c0b16a5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns06.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/level2/core/namednodemapsetnameditemns06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns06'; + + +/** +* + Retreieve the first element whose localName is address and its attributes into a named node map. + Retreiving the domestic attribute from the namednodemap. + Retreieve the second element whose localName is address and its attributes into a named node map. + Invoke setNamedItemNS on the second NamedNodeMap specifying the first domestic attribute from + the first map. This should raise an INUSE_ATTRIBIUTE_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function namednodemapsetnameditemns06() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns06") != null) return; + var doc; + var attributes; + var elementList; + var element; + var attr; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(0); + attributes = element.attributes; + + attr = attributes.getNamedItemNS("http://www.usa.com","domestic"); + element = elementList.item(1); + attributes = element.attributes; + + + { + success = false; + try { + newNode = attributes.setNamedItemNS(attr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("namednodemapsetnameditemns06",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.html new file mode 100644 index 0000000000..0be6db7136 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns07.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/level2/core/namednodemapsetnameditemns07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns07'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName and + raises a INUSE_ATTRIBUTE_ERR Raised if arg is an Attr that is already an + attribute of another Element object. + + Retreieve the attributes of first element whose localName is address into a named node map. + Retreive the attribute whose namespaceURI=http://www.usa.com and localName=domestic + from the NamedNodeMap. Retreieve the attributes of second element whose localName is address + into a named node map. Call the setNamedItemNS method on the second nodemap with the domestic + attribute that was retreived and removed from the first nodeMap as an argument. + Assuming that when an attribute is removed from a nodemap, it still remains in the domtree + his should raise an INUSE_ATTRIBIUTE_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function namednodemapsetnameditemns07() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns07") != null) return; + var doc; + var attributes; + var elementList; + var element; + var attr; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(0); + attributes = element.attributes; + + attr = attributes.getNamedItemNS("http://www.usa.com","domestic"); + element = elementList.item(1); + attributes = element.attributes; + + + { + success = false; + try { + newNode = attributes.setNamedItemNS(attr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("namednodemapsetnameditemns07",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.html new file mode 100644 index 0000000000..8d2097a565 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns08.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/level2/core/namednodemapsetnameditemns08</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns08']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns08'; + + +/** +* + raises a INUSE_ATTRIBUTE_ERR Raised if arg is an Attr that is already an + attribute of another Element object. + + Retreieve the first element whose localName is address and its attributes into a named node map. + Retreiving the domestic attribute from the namednodemap. Retreieve the second element whose + localName is address and its attributes into a named node map. Invoke setNamedItemNS on the + second NamedNodeMap specifying the attribute from the first map. + This should raise an INUSE_ATTRIBIUTE_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function namednodemapsetnameditemns08() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns08") != null) return; + var doc; + var attributes; + var elementList; + var element; + var attr; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagNameNS("*","address"); + element = elementList.item(0); + attributes = element.attributes; + + attr = attributes.getNamedItemNS("http://www.usa.com","domestic"); + element = elementList.item(1); + attributes = element.attributes; + + + { + success = false; + try { + newNode = attributes.setNamedItemNS(attr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 10); + } + assertTrue("namednodemapsetnameditemns08",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns08</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.html new file mode 100644 index 0000000000..777b18d923 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns09.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/level2/core/namednodemapsetnameditemns09</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns09'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName and + raises a NO_MODIFICATION_ALLOWED_ERR if this map is readonly. + + Create a new attribute node and attempt to add it to the nodemap of entities and notations + for this documenttype. This should reaise a NO_MODIFICATION_ALLOWED_ERR. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function namednodemapsetnameditemns09() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns09") != null) return; + var doc; + var docType; + var entities; + var notations; + var attr; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + entities = docType.entities; + + notations = docType.notations; + + attr = doc.createAttributeNS("http://www.w3.org/DOM/Test","test"); + + { + success = false; + try { + newNode = entities.setNamedItemNS(attr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities",success); + } + + { + success = false; + try { + newNode = notations.setNamedItemNS(attr); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 7); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapsetnameditemns09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.html new file mode 100644 index 0000000000..e99b5cdd36 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns10.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/level2/core/namednodemapsetnameditemns10</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns10']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns10'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName and + raises a HIERARCHY_REQUEST_ERR if an attempt is made to add a node doesn't belong + in this NamedNodeMap. + + Attempt to add an entity to a NamedNodeMap of attribute nodes, + Since nodes of this type cannot be added to the attribute node map a HIERARCHY_REQUEST_ERR + should be raised. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function namednodemapsetnameditemns10() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns10") != null) return; + var doc; + var docType; + var entities; + var attributes; + var entity; + var notation; + var element; + var elementList; + var newNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +entity = entities.getNamedItem("ent1"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(0); + attributes = element.attributes; + + + { + success = false; + try { + newNode = attributes.setNamedItemNS(entity); + } + 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/level2/core/namednodemapsetnameditemns10</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.html b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.html new file mode 100644 index 0000000000..689c233eb7 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namednodemapsetnameditemns11.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/level2/core/namednodemapsetnameditemns11</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namednodemapsetnameditemns11']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namednodemapsetnameditemns11'; + + +/** +* + The method setNamedItemNS adds a node using its namespaceURI and localName and + raises a HIERARCHY_REQUEST_ERR if an attempt is made to add a node doesn't belong + in this NamedNodeMap. + + Attempt to add a notation node to a NamedNodeMap of attribute nodes, + Since notations nodes do not belong in the attribute node map a HIERARCHY_REQUEST_ERR + should be raised. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function namednodemapsetnameditemns11() { + var success; + if(checkInitialization(builder, "namednodemapsetnameditemns11") != null) return; + var doc; + var docType; + var notations; + var attributes; + var notation; + var element; + var elementList; + var newNode; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +notation = notations.getNamedItem("notation1"); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); + element = elementList.item(0); + attributes = element.attributes; + + + { + success = false; + try { + newNode = attributes.setNamedItemNS(notation); + } + 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/level2/core/namednodemapsetnameditemns11</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI01.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI01.html new file mode 100644 index 0000000000..e0a078eb1b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI01.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/level2/core/namespaceURI01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namespaceURI01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namespaceURI01'; + + +/** +* + The "getNamespaceURI()" method for an Attribute + returns the namespace URI of this node, or null if unspecified. + + Retrieve the first "emp:address" node which has an attribute of "emp:district" + that is specified in the DTD. + Invoke the "getNamespaceURI()" method on the attribute. + The method should return "http://www.nist.gov". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 +*/ +function namespaceURI01() { + var success; + if(checkInitialization(builder, "namespaceURI01") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrNamespaceURI; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","district"); + attrNamespaceURI = addrAttr.namespaceURI; + + assertEquals("namespaceURI","http://www.nist.gov",attrNamespaceURI); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI02.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI02.html new file mode 100644 index 0000000000..49d3a27d07 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI02.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/level2/core/namespaceURI02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namespaceURI02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namespaceURI02'; + + +/** +* + The "getNamespaceURI()" method for an Attribute + returns the namespace URI of this node, or null if unspecified. + + Retrieve the first emp:address node and get the emp:domestic attribute. + Invoke the "getNamespaceURI()" method on the attribute. + The method should return "http://www.nist.gov". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname +*/ +function namespaceURI02() { + var success; + if(checkInitialization(builder, "namespaceURI02") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attrNamespaceURI; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddressNotNull",testAddr); +addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","domestic"); + attrNamespaceURI = addrAttr.namespaceURI; + + assertEquals("namespaceURI","http://www.nist.gov",attrNamespaceURI); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html new file mode 100644 index 0000000000..c4a7690984 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI03.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namespaceURI03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namespaceURI03'; + + +/** +* + The "getNamespaceURI()" method for a Node + returns the namespace URI of this node, or null if unspecified. + + Retrieve the first employee node and invoke the "getNamespaceURI()" + method. The method should return "http://www.nist.gov". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname +*/ +function namespaceURI03() { + var success; + if(checkInitialization(builder, "namespaceURI03") != null) return; + var doc; + var elementList; + var testEmployee; + var employeeNamespace; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testEmployee = elementList.item(0); + assertNotNull("employeeNotNull",testEmployee); +employeeNamespace = testEmployee.namespaceURI; + + assertEquals("namespaceURI","http://www.nist.gov",employeeNamespace); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_namespaceURI04.html b/dom/tests/mochitest/dom-level2-core/test_namespaceURI04.html new file mode 100644 index 0000000000..765c516e9d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_namespaceURI04.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/level2/core/namespaceURI04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['namespaceURI04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'namespaceURI04'; + + +/** +* + Retrieve the second employee node and invoke the "getNamespaceURI()" + method. The method should return "null". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname +*/ +function namespaceURI04() { + var success; + if(checkInitialization(builder, "namespaceURI04") != null) return; + var doc; + var elementList; + var testEmployee; + var employeeNamespace; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testEmployee = elementList.item(1); + employeeNamespace = testEmployee.namespaceURI; + + + if( + + (builder.contentType == "image/svg+xml") + + ) { + assertTrue("employeeNS_svg", + + ( + (employeeNamespace == null) + || ("http://www.w3.org/2001/DOM-Test-Suite/Level-2/Files" == employeeNamespace)) +); + + } + + else { + assertNull("employeeNS_null",employeeNamespace); + + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/namespaceURI04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.html b/dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.html new file mode 100644 index 0000000000..303ffef14c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodegetlocalname03.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/level2/core/nodegetlocalname03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetlocalname03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'nodegetlocalname03'; + + +/** +* + The method getLocalName returns the local part of the qualified name of this node. + + Ceate two new element nodes and atribute nodes, with and without namespace prefixes. + Retreive the local part of their qualified names using getLocalName and verrify + if it is correct. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN +*/ +function nodegetlocalname03() { + var success; + if(checkInitialization(builder, "nodegetlocalname03") != null) return; + var doc; + var element; + var qelement; + var attr; + var qattr; + var localElemName; + var localQElemName; + var localAttrName; + var localQAttrName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM/Test/elem","elem"); + qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem"); + attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","attr"); + qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr"); + localElemName = element.localName; + + localQElemName = qelement.localName; + + localAttrName = attr.localName; + + localQAttrName = qattr.localName; + + assertEquals("nodegetlocalname03_localElemName","elem",localElemName); + assertEquals("nodegetlocalname03_localQElemName","qelem",localQElemName); + assertEquals("nodegetlocalname03_localAttrName","attr",localAttrName); + assertEquals("nodegetlocalname03_localQAttrName","qattr",localQAttrName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetlocalname03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.html b/dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.html new file mode 100644 index 0000000000..198b950ca4 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodegetnamespaceuri03.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/level2/core/nodegetnamespaceuri03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetnamespaceuri03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'nodegetnamespaceuri03'; + + +/** +* + The method getNamespaceURI returns the namespace URI of this node, or null if it is unspecified + For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with + a DOM Level 1 method, such as createElement from the Document interface, this is always null. + + Ceate two new element nodes and atribute nodes, with and without namespace prefixes. + Retreive their namespaceURI's using getNamespaceURI and verrify if it is correct. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function nodegetnamespaceuri03() { + var success; + if(checkInitialization(builder, "nodegetnamespaceuri03") != null) return; + var doc; + var element; + var elementNS; + var attr; + var attrNS; + var elemNSURI; + var elemNSURINull; + var attrNSURI; + var attrNSURINull; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS(nullNS,"elem"); + elementNS = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem"); + attr = doc.createAttributeNS(nullNS,"attr"); + attrNS = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr"); + elemNSURI = elementNS.namespaceURI; + + elemNSURINull = element.namespaceURI; + + attrNSURI = attrNS.namespaceURI; + + attrNSURINull = attr.namespaceURI; + + assertEquals("nodegetnamespaceuri03_elemNSURI","http://www.w3.org/DOM/Test/elem",elemNSURI); + assertNull("nodegetnamespaceuri03_1",elemNSURINull); + assertEquals("nodegetnamespaceuri03_attrNSURI","http://www.w3.org/DOM/Test/attr",attrNSURI); + assertNull("nodegetnamespaceuri03_2",attrNSURINull); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetnamespaceuri03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.html b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.html new file mode 100644 index 0000000000..28dacf12c9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument01.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/level2/core/nodegetownerdocument01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetownerdocument01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'nodegetownerdocument01'; + + +/** +* + The method getOwnerDocument returns the Document object associated with this node + + Create a new DocumentType node. Since this node is not used with any Document yet + verify if the ownerDocument is null. + + The specification has changed! ownerDocument should not be null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function nodegetownerdocument01() { + var success; + if(checkInitialization(builder, "nodegetownerdocument01") != null) return; + var doc; + var ownerDoc; + var domImpl; + var docType; + var nullID = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + domImpl = doc.implementation; +docType = domImpl.createDocumentType("mydoc",nullID,nullID); + ownerDoc = docType.ownerDocument; + + assertNotNull("nodegetownerdocument01",ownerDoc); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetownerdocument01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.html b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.html new file mode 100644 index 0000000000..8f91797a41 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodegetownerdocument02.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/level2/core/nodegetownerdocument02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetownerdocument02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'nodegetownerdocument02'; + + +/** +* + The method getOwnerDocument returns the Document object associated with this node + + Create a new Document node. Since this node is not used with any Document yet + verify if the ownerDocument is null. Create a new element Node on the new Document + object. Check the ownerDocument of the new element node. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 +*/ +function nodegetownerdocument02() { + var success; + if(checkInitialization(builder, "nodegetownerdocument02") != null) return; + var doc; + var newDoc; + var newElem; + var ownerDocDoc; + var ownerDocElem; + var domImpl; + var docType; + var nullNS = null; + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + domImpl = doc.implementation; +docType = domImpl.createDocumentType("mydoc",nullNS,nullNS); + newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","mydoc",docType); + ownerDocDoc = newDoc.ownerDocument; + + assertNull("nodegetownerdocument02_1",ownerDocDoc); + newElem = newDoc.createElementNS("http://www.w3.org/DOM/Test","myelem"); + ownerDocElem = newElem.ownerDocument; + + assertNotNull("nodegetownerdocument02_2",ownerDocElem); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetownerdocument02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.html b/dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.html new file mode 100644 index 0000000000..d9c4140ffd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodegetprefix03.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/level2/core/nodegetprefix03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodegetprefix03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", 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 = 'nodegetprefix03'; + + +/** +* + The method getPrefix returns the namespace prefix of this node, or null if it is unspecified. + + Ceate two new element nodes and atribute nodes, with and without namespace prefixes. + Retreive the prefix part of their qualified names using getPrefix and verify + if it is correct. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix +*/ +function nodegetprefix03() { + var success; + if(checkInitialization(builder, "nodegetprefix03") != null) return; + var doc; + var element; + var qelement; + var attr; + var qattr; + var elemNoPrefix; + var elemPrefix; + var attrNoPrefix; + var attrPrefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + element = doc.createElementNS("http://www.w3.org/DOM/Test/elem","elem"); + qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem"); + attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","attr"); + qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr"); + elemNoPrefix = element.prefix; + + elemPrefix = qelement.prefix; + + attrNoPrefix = attr.prefix; + + attrPrefix = qattr.prefix; + + assertNull("nodegetprefix03_1",elemNoPrefix); + assertEquals("nodegetprefix03_2","qual",elemPrefix); + assertNull("nodegetprefix03_3",attrNoPrefix); + assertEquals("nodegetprefix03_4","qual",attrPrefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodegetprefix03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html new file mode 100644 index 0000000000..82bca3a4e5 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes01.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodehasattributes01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodehasattributes01'; + + +/** +* + The method hasAttributes returns whether this node (if it is an element) has any attributes. + + Retreive an element node without attributes. Verify if hasAttributes returns false. + Retreive another element node with attributes. Verify if hasAttributes returns true. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function nodehasattributes01() { + var success; + if(checkInitialization(builder, "nodehasattributes01") != null) return; + var doc; + var element; + var elementList; + var hasAttributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + elementList = doc.getElementsByTagName("employeeId"); + element = elementList.item(0); + hasAttributes = element.hasAttributes(); + assertFalse("employeeIdHasAttributesFalse",hasAttributes); +elementList = doc.getElementsByTagName("address"); + element = elementList.item(0); + hasAttributes = element.hasAttributes(); + assertTrue("addressHasAttributesTrue",hasAttributes); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html new file mode 100644 index 0000000000..b94abf3c83 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes02.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodehasattributes02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodehasattributes02'; + + +/** +* + The method hasAttributes returns whether this node (if it is an element) has any attributes. + + Retrieve the docType node. Since this is not an element node check if hasAttributes returns + null. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function nodehasattributes02() { + var success; + if(checkInitialization(builder, "nodehasattributes02") != null) return; + var doc; + var docType; + var hasAttributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + hasAttributes = docType.hasAttributes(); + assertFalse("nodehasattributes02",hasAttributes); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html new file mode 100644 index 0000000000..5b365a2d01 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes03.html @@ -0,0 +1,119 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodehasattributes03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodehasattributes03'; + + +/** +* + The method hasAttributes returns whether this node (if it is an element) has any attributes. + + Retreive an element node with a default attributes. Verify if hasAttributes returns true. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function nodehasattributes03() { + var success; + if(checkInitialization(builder, "nodehasattributes03") != null) return; + var doc; + var element; + var elementList; + var hasAttributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:employee"); + element = elementList.item(0); + assertNotNull("empEmployeeNotNull",element); +hasAttributes = element.hasAttributes(); + assertTrue("hasAttributes",hasAttributes); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.html b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.html new file mode 100644 index 0000000000..e3af33f0e3 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodehasattributes04.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/level2/core/nodehasattributes04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodehasattributes04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodehasattributes04'; + + +/** +* + The method hasAttributes returns whether this node (if it is an element) has any attributes. + + Create a new Document, Element and Attr node. Add the Attr to the Element and append the + Element to the Document. Retreive the newly created element node from the document and check + if it has attributes using hasAttributes. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs +*/ +function nodehasattributes04() { + var success; + if(checkInitialization(builder, "nodehasattributes04") != null) return; + var doc; + var newDoc; + var docType = null; + + var domImpl; + var element; + var elementTest; + var elementDoc; + var attribute; + var setNode; + var appendedChild; + var elementList; + var hasAttributes; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","test",docType); + element = newDoc.createElementNS("http://www.w3.org/DOM/Test","dom:elem"); + attribute = newDoc.createAttribute("attr"); + setNode = element.setAttributeNode(attribute); + elementDoc = newDoc.documentElement; + + appendedChild = elementDoc.appendChild(element); + elementList = newDoc.getElementsByTagNameNS("http://www.w3.org/DOM/Test","elem"); + elementTest = elementList.item(0); + hasAttributes = elementTest.hasAttributes(); + assertTrue("nodehasattributes04",hasAttributes); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html b/dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html new file mode 100644 index 0000000000..2a2beab4ad --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_nodenormalize01.html @@ -0,0 +1,238 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodenormalize01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['nodenormalize01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'nodenormalize01'; + + +/** +* + The method "normalize" puts all Text nodes in the full depth of the sub-tree underneath + this Node, including attribute nodes, into a "normal" form where only structure + (e.g., elements, comments, processing instructions, CDATA sections, and entity references) + separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. + + Create a dom tree consisting of elements, comments, processing instructions, CDATA sections, + and entity references nodes seperated by text nodes. Check the length of the node list of each + before and after normalize has been called. + +* @author IBM +* @author Neil Delima +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize +*/ +function nodenormalize01() { + var success; + if(checkInitialization(builder, "nodenormalize01") != null) return; + var doc; + var newDoc; + var domImpl; + var docType; + var docTypeNull = null; + + var documentElement; + var element1; + var element2; + var element3; + var element4; + var element5; + var element6; + var element7; + var text1; + var text2; + var text3; + var pi; + var cData; + var comment; + var entRef; + var elementList; + var appendedChild; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + domImpl = doc.implementation; +newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:root",docTypeNull); + element1 = newDoc.createElement("element1"); + element2 = newDoc.createElement("element2"); + element3 = newDoc.createElement("element3"); + element4 = newDoc.createElement("element4"); + element5 = newDoc.createElement("element5"); + element6 = newDoc.createElement("element6"); + element7 = newDoc.createElement("element7"); + text1 = newDoc.createTextNode("text1"); + text2 = newDoc.createTextNode("text2"); + text3 = newDoc.createTextNode("text3"); + cData = newDoc.createCDATASection("Cdata"); + comment = newDoc.createComment("comment"); + pi = newDoc.createProcessingInstruction("PITarget","PIData"); + entRef = newDoc.createEntityReference("EntRef"); + assertNotNull("createdEntRefNotNull",entRef); +documentElement = newDoc.documentElement; + + appendedChild = documentElement.appendChild(element1); + appendedChild = element2.appendChild(text1); + appendedChild = element2.appendChild(text2); + appendedChild = element2.appendChild(text3); + appendedChild = element1.appendChild(element2); + text1 = text1.cloneNode(false); + text2 = text2.cloneNode(false); + appendedChild = element3.appendChild(entRef); + appendedChild = element3.appendChild(text1); + appendedChild = element3.appendChild(text2); + appendedChild = element1.appendChild(element3); + text1 = text1.cloneNode(false); + text2 = text2.cloneNode(false); + appendedChild = element4.appendChild(cData); + appendedChild = element4.appendChild(text1); + appendedChild = element4.appendChild(text2); + appendedChild = element1.appendChild(element4); + text2 = text2.cloneNode(false); + text3 = text3.cloneNode(false); + appendedChild = element5.appendChild(comment); + appendedChild = element5.appendChild(text2); + appendedChild = element5.appendChild(text3); + appendedChild = element1.appendChild(element5); + text2 = text2.cloneNode(false); + text3 = text3.cloneNode(false); + appendedChild = element6.appendChild(pi); + appendedChild = element6.appendChild(text2); + appendedChild = element6.appendChild(text3); + appendedChild = element1.appendChild(element6); + entRef = entRef.cloneNode(false); + text1 = text1.cloneNode(false); + text2 = text2.cloneNode(false); + text3 = text3.cloneNode(false); + appendedChild = element7.appendChild(entRef); + appendedChild = element7.appendChild(text1); + appendedChild = element7.appendChild(text2); + appendedChild = element7.appendChild(text3); + appendedChild = element1.appendChild(element7); + elementList = element1.childNodes; + + assertSize("nodeNormalize01_1Bef",6,elementList); +elementList = element2.childNodes; + + assertSize("nodeNormalize01_2Bef",3,elementList); +elementList = element3.childNodes; + + assertSize("nodeNormalize01_3Bef",3,elementList); +elementList = element4.childNodes; + + assertSize("nodeNormalize01_4Bef",3,elementList); +elementList = element5.childNodes; + + assertSize("nodeNormalize01_5Bef",3,elementList); +elementList = element6.childNodes; + + assertSize("nodeNormalize01_6Bef",3,elementList); +elementList = element7.childNodes; + + assertSize("nodeNormalize01_7Bef",4,elementList); +newDoc.normalize(); + elementList = element1.childNodes; + + assertSize("nodeNormalize01_1Aft",6,elementList); +elementList = element2.childNodes; + + assertSize("nodeNormalize01_2Aft",1,elementList); +elementList = element3.childNodes; + + assertSize("nodeNormalize01_3Aft",2,elementList); +elementList = element4.childNodes; + + assertSize("nodeNormalize01_4Aft",2,elementList); +elementList = element5.childNodes; + + assertSize("nodeNormalize01_5Aft",2,elementList); +elementList = element6.childNodes; + + assertSize("nodeNormalize01_6Aft",2,elementList); +elementList = element7.childNodes; + + assertSize("nodeNormalize01_7Aft",2,elementList); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodenormalize01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_normalize01.html b/dom/tests/mochitest/dom-level2-core/test_normalize01.html new file mode 100644 index 0000000000..3264355281 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_normalize01.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/level2/core/normalize01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['normalize01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'normalize01'; + + +/** +* + 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. + + This appears to be a duplicate of elementnormalize.xml in DOM L1 Test Suite + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359 +*/ +function normalize01() { + var success; + if(checkInitialization(builder, "normalize01") != null) return; + var doc; + var root; + var elementList; + var firstChild; + var textList; + var textNode; + var data; + + 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"); + firstChild = elementList.item(2); + textList = firstChild.childNodes; + + textNode = textList.item(0); + data = textNode.data; + + assertEquals("data","Roger\n Jones",data); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/normalize01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html b/dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html new file mode 100644 index 0000000000..8f676c9d41 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_ownerDocument01.html @@ -0,0 +1,117 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerDocument01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['ownerDocument01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'ownerDocument01'; + + +/** +* + The "getOwnerDocument()" method returns null if the target + node itself is a DocumentType which is not used with any document yet. + + Invoke the "getOwnerDocument()" method on the master + document. The DocumentType returned should be null. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc +*/ +function ownerDocument01() { + var success; + if(checkInitialization(builder, "ownerDocument01") != 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("throw_Null",ownerDocument); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerDocument01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_ownerElement01.html b/dom/tests/mochitest/dom-level2-core/test_ownerElement01.html new file mode 100644 index 0000000000..ba2d14b5e2 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_ownerElement01.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/level2/core/ownerElement01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['ownerElement01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'ownerElement01'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute + is attached to or null if this attribute is not in use. + Get the "domestic" attribute from the first "address" node. + Apply the "getOwnerElement()" method to get the Element associated + with the attribute. The value returned should be "address". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 +*/ +function ownerElement01() { + var success; + if(checkInitialization(builder, "ownerElement01") != null) return; + var doc; + var addressList; + var testNode; + var attributes; + var domesticAttr; + var elementNode; + 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(0); + attributes = testNode.attributes; + + domesticAttr = attributes.getNamedItem("domestic"); + elementNode = domesticAttr.ownerElement; + + name = elementNode.nodeName; + + assertEquals("throw_Equals","address",name); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_ownerElement02.html b/dom/tests/mochitest/dom-level2-core/test_ownerElement02.html new file mode 100644 index 0000000000..bbc4eede86 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_ownerElement02.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['ownerElement02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staff"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'ownerElement02'; + + +/** +* + The "getOwnerElement()" will return the Element node this attribute + is attached to or null if this attribute is not in use. + Create a new attribute. + Apply the "getOwnerElement()" method to get the Element associated + with the attribute. The value returned should be "null" since this + attribute is not in use. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement +*/ +function ownerElement02() { + var success; + if(checkInitialization(builder, "ownerElement02") != null) return; + var doc; + var newAttr; + var elementNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staff"); + newAttr = doc.createAttribute("newAttribute"); + elementNode = newAttr.ownerElement; + + assertNull("throw_Null",elementNode); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_prefix01.html b/dom/tests/mochitest/dom-level2-core/test_prefix01.html new file mode 100644 index 0000000000..d1ed87b2e1 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_prefix01.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/level2/core/prefix01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['prefix01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'prefix01'; + + +/** +* + The "getPrefix()" method for a Node + returns the namespace prefix of the node, + and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE + and nodes created with a DOM Level 1 method, this is null. + + Create an new Element with the createElement() method. + Invoke the "getPrefix()" method on the newly created element + node will cause "null" to be returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix +*/ +function prefix01() { + var success; + if(checkInitialization(builder, "prefix01") != null) return; + var doc; + var createdNode; + var prefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + createdNode = doc.createElement("test:employee"); + prefix = createdNode.prefix; + + assertNull("throw_Null",prefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_prefix03.html b/dom/tests/mochitest/dom-level2-core/test_prefix03.html new file mode 100644 index 0000000000..6960ace268 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_prefix03.html @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['prefix03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'prefix03'; + + +/** +* + The "getPrefix()" method for a node + returns the namespace prefix of this node, or null if it is unspecified. + + Retrieve the first emp:employee node and invoke the getPrefix() method." + The method should return "emp". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix +*/ +function prefix03() { + var success; + if(checkInitialization(builder, "prefix03") != null) return; + var doc; + var elementList; + var testEmployee; + var prefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:employee"); + testEmployee = elementList.item(0); + assertNotNull("empEmployeeNotNull",testEmployee); +prefix = testEmployee.prefix; + + assertEquals("prefix","emp",prefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_prefix04.html b/dom/tests/mochitest/dom-level2-core/test_prefix04.html new file mode 100644 index 0000000000..97fac3e3fe --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_prefix04.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/level2/core/prefix04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['prefix04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'prefix04'; + + +/** +* + The "getPrefix()" method for a node + returns the namespace prefix of this node, or null if it is unspecified. + + Retrieve the first employee node and invoke the getPrefix() method." + The method should return "null". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix +*/ +function prefix04() { + var success; + if(checkInitialization(builder, "prefix04") != null) return; + var doc; + var elementList; + var testEmployee; + var prefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testEmployee = elementList.item(0); + prefix = testEmployee.prefix; + + assertNull("throw_Null",prefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_publicId01.html b/dom/tests/mochitest/dom-level2-core/test_publicId01.html new file mode 100644 index 0000000000..ac57ed25bd --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_publicId01.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/level2/core/publicId01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['publicId01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'publicId01'; + + +/** +* + The "getPublicId()" method of a documenttype node contains + the public identifier associated with the external subset. + + Retrieve the documenttype. + Apply the "getPublicId()" method. The string "STAFF" should be + returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId +*/ +function publicId01() { + var success; + if(checkInitialization(builder, "publicId01") != null) return; + var doc; + var docType; + var publicId; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + publicId = docType.publicId; + + assertEquals("throw_Equals","STAFF",publicId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/publicId01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.html new file mode 100644 index 0000000000..dfafdc4d56 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS01.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/level2/core/removeAttributeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['removeAttributeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'removeAttributeNS01'; + + +/** +* + The "removeAttributeNS(namespaceURI,localName)" 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 an attribute + from the entity reference by executing the + "removeAttributeNS(namespaceURI,localName)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElRemAtNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function removeAttributeNS01() { + var success; + if(checkInitialization(builder, "removeAttributeNS01") != null) return; + var doc; + var genderList; + var gender; + var gen; + var gList; + var genElement; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + gen = gender.firstChild; + + nodeType = gen.nodeType; + + + if( + (1 == nodeType) + ) { + gen = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",gen); + + } + gList = gen.childNodes; + + genElement = gList.item(0); + assertNotNull("notnull",genElement); + + { + success = false; + try { + genElement.removeAttributeNS("www.xyz.com","local1"); + } + 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/level2/core/removeAttributeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.html new file mode 100644 index 0000000000..5b790fcf1a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_removeAttributeNS02.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/level2/core/removeAttributeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['removeAttributeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + setImplementationAttribute("validating", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'removeAttributeNS02'; + + +/** +* + The "removeAttributeNS(namespaceURI,localName)" removes an attribute by + local name and namespace URI. If the removed attribute has a + default value it is immediately replaced. The replacing attribute has the same + namespace URI and local name, as well as the original prefix. + + Retrieve the attribute named "emp:local" from emp:address + node, then remove the "emp:local" + attribute by invoking the "removeAttributeNS(namespaceURI,localName)" method. + The "emp:local" 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/DOM-Level-2-Core/core#ID-ElRemAtNS +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 +*/ +function removeAttributeNS02() { + var success; + if(checkInitialization(builder, "removeAttributeNS02") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var attr; + var namespaceURI; + var localName; + var prefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + testAddr.removeAttributeNS("http://www.nist.gov","local1"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","local1"); + attr = testAddr.getAttributeNS("http://www.nist.gov","local1"); + namespaceURI = addrAttr.namespaceURI; + + localName = addrAttr.localName; + + prefix = testAddr.prefix; + + assertEquals("attr","FALSE",attr); + assertEquals("uri","http://www.nist.gov",namespaceURI); + assertEquals("lname","local1",localName); + assertEquals("prefix","emp",prefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.html b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.html new file mode 100644 index 0000000000..6d85b8d01d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS01.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/level2/core/removeNamedItemNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['removeNamedItemNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'removeNamedItemNS01'; + + +/** +* + The "removeNamedItemNS(namespaceURI,localName)" method for a + NamedNodeMap should remove a node specified by localName and namespaceURI. + + Retrieve a list of elements with tag name "address". + Access the second element from the list and get its attributes. + Try to remove the attribute node with local name "domestic" + and namespace uri "http://www.usa.com" with + method removeNamedItemNS(namespaceURI,localName). + Check to see if the node has been removed. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549 +*/ +function removeNamedItemNS01() { + var success; + if(checkInitialization(builder, "removeNamedItemNS01") != null) return; + var doc; + var elementList; + var testAddress; + var attributes; + var newAttr; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + attributes = testAddress.attributes; + + removedNode = attributes.removeNamedItemNS("http://www.usa.com","domestic"); + assertNotNull("retval",removedNode); +newAttr = attributes.getNamedItem("dmstc:domestic"); + assertNull("nodeRemoved",newAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.html b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.html new file mode 100644 index 0000000000..132ec5599d --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS02.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/level2/core/removeNamedItemNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['removeNamedItemNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'removeNamedItemNS02'; + + +/** +* + The "removeNamedItemNS(namespaceURI,localName)" method for a + NamedNodeMap should raise NOT_FOUND_ERR DOMException if + there is no node with the specified namespaceURI and localName in this map. + + Retrieve a list of elements with tag name "address". + Access the second element from the list and get its attributes. + Try to remove an attribute node with local name "domest" + and namespace uri "http://www.usa.com" with + method removeNamedItemNS(namespaceURI,localName). + This should raise NOT_FOUND_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) +*/ +function removeNamedItemNS02() { + var success; + if(checkInitialization(builder, "removeNamedItemNS02") != null) return; + var namespaceURI = "http://www.usa.com"; + var localName = "domest"; + var doc; + var elementList; + var testAddress; + var attributes; + var removedNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + attributes = testAddress.attributes; + + + { + success = false; + try { + removedNode = attributes.removeNamedItemNS(namespaceURI,localName); + } + 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/level2/core/removeNamedItemNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.html b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.html new file mode 100644 index 0000000000..0b41f3fc0a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_removeNamedItemNS03.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/level2/core/removeNamedItemNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['removeNamedItemNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'removeNamedItemNS03'; + + +/** +* + The "removeNamedItemNS(namespaceURI,localName)" method for a + NamedNodeMap should raise NO_MODIFICATION_ALLOWED_ERR DOMException if + this map is readonly. + + Retrieve a list of "gender" elements. Get access to the THIRD element + which contains an ENTITY_REFERENCE child node. Try to remove the attribute + in the node's map with method removeNamedItemNS(namespaceURI,localName). + This should result in NO_MODIFICATION_ALLOWED_ERR + DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function removeNamedItemNS03() { + var success; + if(checkInitialization(builder, "removeNamedItemNS03") != null) return; + var namespaceURI = "http://www.w3.org/2000/xmlns/"; + var localName = "local1"; + var doc; + var elementList; + var testAddress; + var nList; + var child; + var n2List; + var child2; + var attributes; + var removedNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("gender"); + testAddress = elementList.item(2); + nList = testAddress.childNodes; + + child = nList.item(0); + nodeType = child.nodeType; + + + if( + (1 == nodeType) + ) { + child = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",child); + + } + n2List = child.childNodes; + + child2 = n2List.item(0); + assertNotNull("notnull",child2); +attributes = child2.attributes; + + + { + success = false; + try { + removedNode = attributes.removeNamedItemNS(namespaceURI,localName); + } + 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/level2/core/removeNamedItemNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.html new file mode 100644 index 0000000000..68abcf4915 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS01.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/level2/core/setAttributeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS01'; + + +/** +* + The "setAttributeNS(namespaceURI,qualifiedName,Value)" method raises a + INVALID_CHARACTER_ERR DOMException if the specified + prefix contains an illegal character. + + Attempt to add a new attribute on the first employee node. + An exception should be raised since the "qualifiedName" has an invalid + character. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +*/ +function setAttributeNS01() { + var success; + if(checkInitialization(builder, "setAttributeNS01") != null) return; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "emp:qual?name"; + var doc; + var elementList; + var testAddr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + success = false; + try { + testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); + } + 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/level2/core/setAttributeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.html new file mode 100644 index 0000000000..162cb66649 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS02.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/level2/core/setAttributeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS02'; + + +/** +* + The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a + NAMESPACE_ERR DOMException if the specified + qualifiedName if malformed. + + Attempt to add a new attribute on the second employee node. + An exception should be raised since the "qualifiedName" is malformed. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function setAttributeNS02() { + var success; + if(checkInitialization(builder, "setAttributeNS02") != null) return; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "emp:"; + var doc; + var elementList; + var testAddr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:employee"); + testAddr = elementList.item(0); + + { + success = false; + try { + testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); + } + catch(ex) { + success = ex.code === DOMException.INVALID_CHARACTER_ERR; + } + assertTrue("throw INVALID_CHARACTER_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.html new file mode 100644 index 0000000000..98afdb02da --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS03.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/level2/core/setAttributeNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS03'; + + +/** +* + The "setAttributeNS(namespaceURI,qualifiedName,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 set an attribute + in the entity reference by executing the + "setAttributeNS(namespaceURI,qualifiedName,value)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function setAttributeNS03() { + var success; + if(checkInitialization(builder, "setAttributeNS03") != null) return; + var namespaceURI = "www.xyz.com"; + var qualifiedName = "emp:local1"; + var doc; + var genderList; + var gender; + var genList; + var gen; + var gList; + var genElement; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + genList = gender.childNodes; + + gen = genList.item(0); + nodeType = gen.nodeType; + + + if( + (1 == nodeType) + ) { + gen = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",gen); + + } + gList = gen.childNodes; + + genElement = gList.item(0); + assertNotNull("notnull",genElement); + + { + success = false; + try { + genElement.setAttributeNS(namespaceURI,qualifiedName,"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/level2/core/setAttributeNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.html new file mode 100644 index 0000000000..f06f726904 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS04.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/level2/core/setAttributeNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS04'; + + +/** +* + The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. + If an attribute with the same local name and namespace URI is already present + on the element, its prefix is changed to be the prefix part of the "qualifiedName", + and its vale is changed to be the "value" paramter. + null value if no previously existing Attr node with the + same name was replaced. + + Add a new attribute to the "emp:address" element. + Check to see if the new attribute has been successfully added to the document + by getting the attributes value, namespace URI, local Name and prefix. + The prefix will be changed to the prefix part of the "qualifiedName" + and its value changed to the "value" parameter. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core# +*/ +function setAttributeNS04() { + var success; + if(checkInitialization(builder, "setAttributeNS04") != null) return; + var doc; + var elementList; + var testAddr; + var addrAttr; + var resultAttr; + var resultNamespaceURI; + var resultLocalName; + var resultPrefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +testAddr.setAttributeNS("http://www.nist.gov","newprefix:zone","newValue"); + addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","zone"); + resultAttr = testAddr.getAttributeNS("http://www.nist.gov","zone"); + assertEquals("attrValue","newValue",resultAttr); + resultNamespaceURI = addrAttr.namespaceURI; + + assertEquals("nsuri","http://www.nist.gov",resultNamespaceURI); + resultLocalName = addrAttr.localName; + + assertEquals("lname","zone",resultLocalName); + resultPrefix = addrAttr.prefix; + + assertEquals("prefix","newprefix",resultPrefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.html new file mode 100644 index 0000000000..443c817f5b --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS05.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/level2/core/setAttributeNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS05'; + + +/** +* + The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. + If an attribute with the same local name and namespace URI is already present + on the element, its prefix is changed to be the prefix part of the "qualifiedName", + and its vale is changed to be the "value" paramter. + null value if no previously existing Attr node with the + same name was replaced. + + Add a new attribute to the "emp:address" element. + Check to see if the new attribute has been successfully added to the document. + The new attribute "<newValue>" contains markup and therefore is escaped + by the implementation. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS +*/ +function setAttributeNS05() { + var success; + if(checkInitialization(builder, "setAttributeNS05") != null) return; + var localName = "newAttr"; + var namespaceURI = "http://www.newattr.com"; + var qualifiedName = "emp:newAttr"; + var doc; + var elementList; + var testAddr; + var addrAttr; + var resultAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +testAddr.setAttributeNS(namespaceURI,qualifiedName,"<newValue>"); + resultAttr = testAddr.getAttributeNS(namespaceURI,localName); + assertEquals("throw_Equals","<newValue>",resultAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.html new file mode 100644 index 0000000000..df92c69281 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS06.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/level2/core/setAttributeNS06</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS06']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS06'; + + +/** +* + The "setAttributeNS(namespaceURI,localName,value)" method raises a + NAMESPACE_ERR DOMException if the "qualifiedName" has a + prefix of "xml" and the namespaceURI is different from + http://www.w3.org/XML/1998/namespace. + + Attempt to add an attribute with a prefix of "xml" as the on the first employee node. + An exception should be raised since the namespaceURI of this node is not + http://www.w3.org/XML/1998/namespace. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function setAttributeNS06() { + var success; + if(checkInitialization(builder, "setAttributeNS06") != null) return; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "xml:qualifiedName"; + var doc; + var elementList; + var testAddr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + success = false; + try { + testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS06</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.html new file mode 100644 index 0000000000..d36789de24 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS07.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/level2/core/setAttributeNS07</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS07']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS07'; + + +/** +* + The "setAttributeNS(namespaceURI,localName,value)" method raises a + NAMESPACE_ERR DOMException if the "qualifiedName" has a + value of "xmlns" and the namespaceURI is different from + http://www.w3.org/2000/xmlns. + + Attempt to add an attribute with a "qualifiedName" of "xmlns" as the + on the first employee node. + An exception should be raised since the namespaceURI of this node is not + http://www.w3.org/2000/xmlns. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) +*/ +function setAttributeNS07() { + var success; + if(checkInitialization(builder, "setAttributeNS07") != null) return; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "xmlns"; + var doc; + var elementList; + var testAddr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + success = false; + try { + testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 14); + } + assertTrue("throw_NAMESPACE_ERR",success); + } + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS07</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.html new file mode 100644 index 0000000000..3b0ca22005 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS09.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/level2/core/setAttributeNS09</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS09']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNS09'; + + +/** +* + The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. + If an attribute with the same local name and namespace URI is already present + on the element, its prefix is changed to be the prefix part of the "qualifiedName", + and its vale is changed to be the "value" paramter. + null value if no previously existing Attr node with the + same name was replaced. + + Add a new attribute to the "emp:address" element. + Check to see if the new attribute has been successfully added to the document + by getting the attributes value, namespace URI, local Name and prefix. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +*/ +function setAttributeNS09() { + var success; + if(checkInitialization(builder, "setAttributeNS09") != null) return; + var localName = "newAttr"; + var namespaceURI = "http://www.newattr.com"; + var qualifiedName = "emp:newAttr"; + var doc; + var elementList; + var testAddr; + var addrAttr; + var resultAttr; + var resultNamespaceURI; + var resultLocalName; + var resultPrefix; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); + addrAttr = testAddr.getAttributeNodeNS(namespaceURI,localName); + resultAttr = testAddr.getAttributeNS(namespaceURI,localName); + assertEquals("attrValue","newValue",resultAttr); + resultNamespaceURI = addrAttr.namespaceURI; + + assertEquals("nsuri","http://www.newattr.com",resultNamespaceURI); + resultLocalName = addrAttr.localName; + + assertEquals("lname","newAttr",resultLocalName); + resultPrefix = addrAttr.prefix; + + assertEquals("prefix","emp",resultPrefix); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS09</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.html new file mode 100644 index 0000000000..0d2ff8b2e8 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNS10.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/level2/core/setAttributeNS10</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNS10']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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 = 'setAttributeNS10'; + + +/** +* +Element.setAttributeNS with an empty qualified name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function setAttributeNS10() { + var success; + if(checkInitialization(builder, "setAttributeNS10") != null) return; + var namespaceURI = "http://www.example.gov"; + var doc; + var elementList; + var testAddr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + elementList = doc.getElementsByTagName("em"); + testAddr = elementList.item(0); + + { + success = false; + try { + testAddr.setAttributeNS(namespaceURI,"","newValue"); + } + 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/level2/core/setAttributeNS10</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +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-level2-core/test_setAttributeNodeNS01.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS01.html new file mode 100644 index 0000000000..80407cd9cb --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS01.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/level2/core/setAttributeNodeNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNodeNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNodeNS01'; + + +/** +* + The "setAttributeNode(newAttr)" method raises an + "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" + is already an attribute of another element. + + Retrieve the first emp:address and append + a newly created element. The "createAttributeNS(namespaceURI,qualifiedName)" + and "setAttributeNodeNS(newAttr)" methods are invoked + to create and add a new attribute to the newly created + Element. The "setAttributeNodeNS(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/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +*/ +function setAttributeNodeNS01() { + var success; + if(checkInitialization(builder, "setAttributeNodeNS01") != null) return; + var namespaceURI = "http://www.newattr.com"; + var qualifiedName = "emp:newAttr"; + var doc; + var newElement; + var newAttr; + var elementList; + var testAddr; + var appendedChild; + var setAttr1; + var setAttr2; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +newElement = doc.createElement("newElement"); + appendedChild = testAddr.appendChild(newElement); + newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); + setAttr1 = newElement.setAttributeNodeNS(newAttr); + + { + success = false; + try { + setAttr2 = testAddr.setAttributeNodeNS(newAttr); + } + 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/level2/core/setAttributeNodeNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.html new file mode 100644 index 0000000000..7fd7447f94 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS02.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/level2/core/setAttributeNodeNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNodeNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", false); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNodeNS02'; + + +/** +* + The "setAttributeNodeNS(namespaceURI,qualifiedName,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 set an attribute + in the entity reference by executing the + "setAttributeNodeNS(newAttr)" method. + This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function setAttributeNodeNS02() { + var success; + if(checkInitialization(builder, "setAttributeNodeNS02") != null) return; + var doc; + var genderList; + var gender; + var genList; + var gen; + var gList; + var genElement; + var newAttr; + var setAttr1; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + if( + (getImplementationAttribute("expandEntityReferences") == false) + ) { + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + genList = gender.childNodes; + + gen = genList.item(0); + + } + + else { + gen = doc.createEntityReference("ent4"); + + } + gList = gen.childNodes; + + genElement = gList.item(0); + assertNotNull("notnull",genElement); +newAttr = doc.createAttributeNS("www.xyz.com","emp:local1"); + + { + success = false; + try { + setAttr1 = genElement.setAttributeNodeNS(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/level2/core/setAttributeNodeNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.html new file mode 100644 index 0000000000..c68f5c35bb --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS03.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/level2/core/setAttributeNodeNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNodeNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNodeNS03'; + + +/** +* + The "setAttributeNodeNS(newAttr)" adds a new attribute. + If an attribute with that local name and that namespaceURI is already + present in the element, it is replaced by the new one. + + Retrieve the first emp:address element and add a new attribute + to the element. Since an attribute with the same local name + and namespaceURI as the newly created attribute does not exist + the value "null" is returned. + This test uses the "createAttributeNS(namespaceURI,localName) + method from the Document interface to create the new attribute to add. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function setAttributeNodeNS03() { + var success; + if(checkInitialization(builder, "setAttributeNodeNS03") != null) return; + var namespaceURI = "http://www.newattr.com"; + var qualifiedName = "emp:newAttr"; + var doc; + var elementList; + var testAddr; + var newAttr; + var newAddrAttr; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); + newAddrAttr = testAddr.setAttributeNodeNS(newAttr); + assertNull("throw_Null",newAddrAttr); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.html new file mode 100644 index 0000000000..c2bf1a372c --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS04.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/level2/core/setAttributeNodeNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNodeNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setAttributeNodeNS04'; + + +/** +* + The "setAttributeNodeNS(newAttr)" adds a new attribute. + If an attribute with that local name and that namespaceURI is already + present in the element, it is replaced by the new one. + + Retrieve the first emp:address element and add a new attribute + to the element. Since an attribute with the same local name + and namespaceURI already exists, it is replaced by the new one and + returns the replaced "Attr" node. + This test uses the "createAttributeNS(namespaceURI,localName) + method from the Document interface to create the new attribute to add. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 +*/ +function setAttributeNodeNS04() { + var success; + if(checkInitialization(builder, "setAttributeNodeNS04") != null) return; + var doc; + var elementList; + var testAddr; + var newAttr; + var newAddrAttr; + var newName; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + assertNotNull("empAddrNotNull",testAddr); +newAttr = doc.createAttributeNS("http://www.nist.gov","xxx:domestic"); + newAddrAttr = testAddr.setAttributeNodeNS(newAttr); + newName = newAddrAttr.nodeName; + + assertEquals("nodeName","emp:domestic",newName); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNodeNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.html b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.html new file mode 100644 index 0000000000..726fd2091a --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setAttributeNodeNS05.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/level2/core/setAttributeNodeNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setAttributeNodeNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised 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", "staffNS"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + docsLoaded += preload(doc2Ref, "doc2", "staffNS"); + + 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 = 'setAttributeNodeNS05'; + + +/** +* + The "setAttributeNodeNS(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 first emp:address and attempt to set a new + attribute node. 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 "createAttributeNS(newAttr)" method + from the Document interface. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +*/ +function setAttributeNodeNS05() { + var success; + if(checkInitialization(builder, "setAttributeNodeNS05") != null) return; + var namespaceURI = "http://www.newattr.com"; + var qualifiedName = "emp:newAttr"; + var doc1; + var doc2; + var newAttr; + var elementList; + var testAddr; + var setAttr1; + + var doc1Ref = null; + if (typeof(this.doc1) != 'undefined') { + doc1Ref = this.doc1; + } + doc1 = load(doc1Ref, "doc1", "staffNS"); + + var doc2Ref = null; + if (typeof(this.doc2) != 'undefined') { + doc2Ref = this.doc2; + } + doc2 = load(doc2Ref, "doc2", "staffNS"); + newAttr = doc2.createAttributeNS(namespaceURI,qualifiedName); + elementList = doc1.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + + { + success = false; + try { + setAttr1 = testAddr.setAttributeNodeNS(newAttr); + } + 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/level2/core/setAttributeNodeNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.html new file mode 100644 index 0000000000..31bf521d11 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS01.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/level2/core/setNamedItemNS01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setNamedItemNS01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setNamedItemNS01'; + + +/** +* + The "setNamedItemNS(arg)" method for a + NamedNodeMap should raise INUSE_ATTRIBUTE_ERR DOMException if + arg is an Attr that is already an attribute of another Element object. + + Retrieve an attr node from the third "address" element whose local name + is "domestic" and namespaceURI is "http://www.netzero.com". + Invoke method setNamedItemNS(arg) on the map of the first "address" element with + arg being the attr node from above. Method should raise + INUSE_ATTRIBUTE_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) +*/ +function setNamedItemNS01() { + var success; + if(checkInitialization(builder, "setNamedItemNS01") != null) return; + var doc; + var elementList; + var anotherElement; + var anotherMap; + var arg; + var testAddress; + var map; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("address"); + anotherElement = elementList.item(2); + anotherMap = anotherElement.attributes; + + arg = anotherMap.getNamedItemNS("http://www.netzero.com","domestic"); + testAddress = elementList.item(0); + map = testAddress.attributes; + + + { + success = false; + try { + setNode = map.setNamedItemNS(arg); + } + 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/level2/core/setNamedItemNS01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.html new file mode 100644 index 0000000000..d33346db17 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS02.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/level2/core/setNamedItemNS02</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setNamedItemNS02']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + var anotherDocRef = null; + if (typeof(this.anotherDoc) != 'undefined') { + anotherDocRef = this.anotherDoc; + } + docsLoaded += preload(anotherDocRef, "anotherDoc", "staffNS"); + + 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 = 'setNamedItemNS02'; + + +/** +* + The "setNamedItemNS(arg)" method for a + NamedNodeMap should raise WRONG_DOCUMENT_ERR DOMException if arg was + created from a different document than the one that created this map. + + Create an attr node in a different document with qualifiedName equals + "dmstc:domestic" and namespaceURI is "http://www.usa.com". + Access the namednodemap of the first "address" element in this document. + Invoke method setNamedItemNS(arg) with arg being the attr node from above. + Method should raise WRONG_DOCUMENT_ERR DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR']) +*/ +function setNamedItemNS02() { + var success; + if(checkInitialization(builder, "setNamedItemNS02") != null) return; + var namespaceURI = "http://www.usa.com"; + var qualifiedName = "dmstc:domestic"; + var doc; + var anotherDoc; + var arg; + var elementList; + var testAddress; + var attributes; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + + var anotherDocRef = null; + if (typeof(this.anotherDoc) != 'undefined') { + anotherDocRef = this.anotherDoc; + } + anotherDoc = load(anotherDocRef, "anotherDoc", "staffNS"); + arg = anotherDoc.createAttributeNS(namespaceURI,qualifiedName); + arg.nodeValue = "Maybe"; + + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(0); + attributes = testAddress.attributes; + + + { + success = false; + try { + setNode = attributes.setNamedItemNS(arg); + } + 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/level2/core/setNamedItemNS02</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.html new file mode 100644 index 0000000000..3c747fb451 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS03.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/level2/core/setNamedItemNS03</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setNamedItemNS03']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setNamedItemNS03'; + + +/** +* + The "setNamedItemNS(arg)" method for a + NamedNodeMap should add a node using its namespaceURI and localName given that + there is no existing node with the same namespaceURI and localName in the map. + + Create an attr node with namespaceURI "http://www.nist.gov",qualifiedName + "prefix:newAttr" and value "newValue". + Invoke method setNamedItemNS(arg) on the map of the first "address" + element where arg is identified by the namespaceURI and qualifiedName + from above. Method should return the newly added attr node. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D080 +*/ +function setNamedItemNS03() { + var success; + if(checkInitialization(builder, "setNamedItemNS03") != null) return; + var namespaceURI = "http://www.nist.gov"; + var qualifiedName = "prefix:newAttr"; + var doc; + var arg; + var elementList; + var testAddress; + var attributes; + var retnode; + var value; + var setNode; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + arg = doc.createAttributeNS(namespaceURI,qualifiedName); + arg.nodeValue = "newValue"; + + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(0); + attributes = testAddress.attributes; + + setNode = attributes.setNamedItemNS(arg); + retnode = attributes.getNamedItemNS(namespaceURI,"newAttr"); + value = retnode.nodeValue; + + assertEquals("throw_Equals","newValue",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS03</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.html new file mode 100644 index 0000000000..a53ecfd0a9 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS04.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/level2/core/setNamedItemNS04</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setNamedItemNS04']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception 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("namespaceAware", true); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setNamedItemNS04'; + + +/** +* + The "setNamedItemNS(arg)" method for a + NamedNodeMap should raise NO_MODIFICATION_ALLOWED_ERR DOMException if + this map is readonly. + + Retrieve a list of "gender" elements. Get access to the THIRD element + which contains an ENTITY_REFERENCE child node. Get access to the node's + map. Try to add an attribute node specified by arg with + method setNamedItemNS(arg). This should result in NO_MODIFICATION_ALLOWED_ERR + DOMException. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR']) +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR']) +*/ +function setNamedItemNS04() { + var success; + if(checkInitialization(builder, "setNamedItemNS04") != null) return; + var namespaceURI = "http://www.w3.org/2000/xmlns/"; + var localName = "local1"; + var doc; + var elementList; + var testAddress; + var nList; + var child; + var n2List; + var child2; + var attributes; + var arg; + var setNode; + var nodeType; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + elementList = doc.getElementsByTagName("gender"); + testAddress = elementList.item(2); + nList = testAddress.childNodes; + + child = nList.item(0); + nodeType = child.nodeType; + + + if( + (1 == nodeType) + ) { + child = doc.createEntityReference("ent4"); + assertNotNull("createdEntRefNotNull",child); + + } + n2List = child.childNodes; + + child2 = n2List.item(0); + assertNotNull("notnull",child2); +attributes = child2.attributes; + + arg = attributes.getNamedItemNS(namespaceURI,localName); + + { + success = false; + try { + setNode = attributes.setNamedItemNS(arg); + } + 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/level2/core/setNamedItemNS04</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.html b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.html new file mode 100644 index 0000000000..ca12b04188 --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_setNamedItemNS05.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/level2/core/setNamedItemNS05</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['setNamedItemNS05']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'setNamedItemNS05'; + + +/** +* + The "setNamedItemNS(arg)" method for a + NamedNodeMap should replace an existing node n1 found in the map with arg if n1 + has the same namespaceURI and localName as arg and return n1. + + Create an attribute node in with namespaceURI "http://www.usa.com" + and qualifiedName "dmstc:domestic" whose value is "newVal". + Invoke method setNamedItemNS(arg) on the map of the first "address" + element. Method should return the old attribute node identified + by namespaceURI and qualifiedName from above,whose value is "Yes". + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS +*/ +function setNamedItemNS05() { + var success; + if(checkInitialization(builder, "setNamedItemNS05") != null) return; + var namespaceURI = "http://www.usa.com"; + var qualifiedName = "dmstc:domestic"; + var doc; + var arg; + var elementList; + var testAddress; + var attributes; + var retnode; + var value; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + arg = doc.createAttributeNS(namespaceURI,qualifiedName); + arg.nodeValue = "newValue"; + + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(0); + attributes = testAddress.attributes; + + retnode = attributes.setNamedItemNS(arg); + value = retnode.nodeValue; + + assertEquals("throw_Equals","Yes",value); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/setNamedItemNS05</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> diff --git a/dom/tests/mochitest/dom-level2-core/test_systemId01.html b/dom/tests/mochitest/dom-level2-core/test_systemId01.html new file mode 100644 index 0000000000..09b29ea1df --- /dev/null +++ b/dom/tests/mochitest/dom-level2-core/test_systemId01.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/level2/core/systemId01</title> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="DOMTestCase.js"></script> +<script type="text/javascript" src="exclusions.js"></script> +<script type="text/javascript"> +// expose test function names +function exposeTestFunctionNames() +{ +return ['systemId01']; +} + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + docsLoaded += preload(docRef, "doc", "staffNS"); + + if (docsLoaded == 1) { + setUpPage = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPage = 'complete'; + } +} + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + runJSUnitTests(); + markTodos(); + SimpleTest.finish(); + } +} + +var docName = 'systemId01'; + + +/** +* + The "getSystemId()" method of a documenttype node contains + the system identifier associated with the external subset. + + Retrieve the documenttype. + Apply the "getSystemId()" method. The string "staffNS.dtd" should be + returned. + +* @author NIST +* @author Mary Brady +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId +*/ +function systemId01() { + var success; + if(checkInitialization(builder, "systemId01") != null) return; + var doc; + var docType; + var systemId; + var index; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "staffNS"); + docType = doc.doctype; + + systemId = docType.systemId; + + assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,systemId); + +} + +</script> +</head> +<body> +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/systemId01</h2> +<p></p> +<p> +Copyright (c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +</p> +</body> +</html> |