diff options
Diffstat (limited to 'LayoutTests/dom/html/level2/core')
36 files changed, 2830 insertions, 0 deletions
diff --git a/LayoutTests/dom/html/level2/core/createAttributeNS06-expected.txt b/LayoutTests/dom/html/level2/core/createAttributeNS06-expected.txt new file mode 100644 index 0000000..cd129e7 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createAttributeNS06-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS06 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/createAttributeNS06.html b/LayoutTests/dom/html/level2/core/createAttributeNS06.html new file mode 100644 index 0000000..a8b546f --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createAttributeNS06.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="createAttributeNS06.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/createAttributeNS06.js b/LayoutTests/dom/html/level2/core/createAttributeNS06.js new file mode 100644 index 0000000..b788b3d --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createAttributeNS06.js @@ -0,0 +1,117 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +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); + } + +} + + + + +function runTest() { + createAttributeNS06(); +} diff --git a/LayoutTests/dom/html/level2/core/createDocument08-expected.txt b/LayoutTests/dom/html/level2/core/createDocument08-expected.txt new file mode 100644 index 0000000..8548903 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createDocument08-expected.txt @@ -0,0 +1,3 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument08 +Status: failure +Detail: throw_INVALID_CHARACTER_ERR: assertTrue failed diff --git a/LayoutTests/dom/html/level2/core/createDocument08.html b/LayoutTests/dom/html/level2/core/createDocument08.html new file mode 100644 index 0000000..5d333bb --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createDocument08.html @@ -0,0 +1,25 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd" > +<html> +<!-- +Copyright(c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C(r) Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +--> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>implementation</title> + <script type='text/javascript' src='selfhtml.js'></script> + <script type='text/javascript' charset='UTF-8' src='createDocument08.js'></script> + <script type='text/javascript'>function loadComplete() { startTest(); }</script> + </head> + <body onload="loadComplete()"> + </body> +</html> + + diff --git a/LayoutTests/dom/html/level2/core/createDocument08.js b/LayoutTests/dom/html/level2/core/createDocument08.js new file mode 100644 index 0000000..bcaacc1 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createDocument08.js @@ -0,0 +1,107 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument08"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + if (docsLoaded == 0) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 0) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +DOMImplementation.createDocument 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# +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function createDocument08() { + var success; + if(checkInitialization(builder, "createDocument08") != null) return; + var namespaceURI = "http://www.example.org/schema"; + var docType = null; + + var domImpl; + var aNewDoc; + var charact; + domImpl = getImplementation(); + + { + success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI,"",docType); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + + + + +function runTest() { + createDocument08(); +} diff --git a/LayoutTests/dom/html/level2/core/createDocumentType04-expected.txt b/LayoutTests/dom/html/level2/core/createDocumentType04-expected.txt new file mode 100644 index 0000000..048d1ca --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createDocumentType04-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType04 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/createDocumentType04.html b/LayoutTests/dom/html/level2/core/createDocumentType04.html new file mode 100644 index 0000000..51d8aab --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createDocumentType04.html @@ -0,0 +1,25 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd" > +<html> +<!-- +Copyright(c) 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C(r) Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +--> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>implementation</title> + <script type='text/javascript' src='selfhtml.js'></script> + <script type='text/javascript' charset='UTF-8' src='createDocumentType04.js'></script> + <script type='text/javascript'>function loadComplete() { startTest(); }</script> + </head> + <body onload="loadComplete()"> + </body> +</html> + + diff --git a/LayoutTests/dom/html/level2/core/createDocumentType04.js b/LayoutTests/dom/html/level2/core/createDocumentType04.js new file mode 100644 index 0000000..d25f864 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createDocumentType04.js @@ -0,0 +1,108 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType04"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + + docsLoaded = 0; + + if (docsLoaded == 0) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 0) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +DOMImplementation.createDocumentType with an empty name should cause an INVALID_CHARACTER_ERR. + +* @author Curt Arnold +* @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']) +* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 +*/ +function createDocumentType04() { + var success; + if(checkInitialization(builder, "createDocumentType04") != null) return; + var publicId = "http://www.example.com/"; + var systemId = "myDoc.dtd"; + var qualifiedName; + var docType = null; + + var domImpl; + domImpl = getImplementation(); + + { + success = false; + try { + docType = domImpl.createDocumentType("",publicId,systemId); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 5); + } + assertTrue("throw_INVALID_CHARACTER_ERR",success); + } + +} + + + + +function runTest() { + createDocumentType04(); +} diff --git a/LayoutTests/dom/html/level2/core/createElementNS06.js b/LayoutTests/dom/html/level2/core/createElementNS06.js new file mode 100644 index 0000000..e0dd3eb --- /dev/null +++ b/LayoutTests/dom/html/level2/core/createElementNS06.js @@ -0,0 +1,119 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +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); + } + +} + + + + +function runTest() { + createElementNS06(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1-expected.txt b/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1-expected.txt new file mode 100644 index 0000000..3dcffbc --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_entitiesremovenameditemns1 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1.html b/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1.html new file mode 100644 index 0000000..ee77758 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_entitiesremovenameditemns1.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1.js b/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1.js new file mode 100644 index 0000000..b747021 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_entitiesremovenameditemns1.js @@ -0,0 +1,141 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_entitiesremovenameditemns1"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +An attempt to add remove an entity using removeNamedItemNS should result in +a NO_MODIFICATION_ERR or a NOT_FOUND_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630 +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS +*/ +function hc_entitiesremovenameditemns1() { + var success; + if(checkInitialization(builder, "hc_entitiesremovenameditemns1") != null) return; + var doc; + var entities; + var docType; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); + + try { + retval = entities.removeNamedItemNS("http://www.w3.org/1999/xhtml","alpha"); + fail("throw_NO_MOD_OR_NOT_FOUND_ERR"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + case /* NOT_FOUND_ERR */ 8 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + } + +} + + + + +function runTest() { + hc_entitiesremovenameditemns1(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1-expected.txt b/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1-expected.txt new file mode 100644 index 0000000..81edeb9 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_entitiessetnameditemns1 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1.html b/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1.html new file mode 100644 index 0000000..306cad1 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_entitiessetnameditemns1.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1.js b/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1.js new file mode 100644 index 0000000..4b5e134 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_entitiessetnameditemns1.js @@ -0,0 +1,143 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_entitiessetnameditemns1"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +An attempt to add an element to the named node map returned by entities should +result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630 +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function hc_entitiessetnameditemns1() { + var success; + if(checkInitialization(builder, "hc_entitiessetnameditemns1") != null) return; + var doc; + var entities; + var docType; + var retval; + var elem; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +entities = docType.entities; + + assertNotNull("entitiesNotNull",entities); +elem = doc.createElementNS("http://www.w3.org/1999/xhtml","br"); + + try { + retval = entities.setNamedItemNS(elem); + fail("throw_HIER_OR_NO_MOD_ERR"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* HIERARCHY_REQUEST_ERR */ 3 : + break; + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + } + +} + + + + +function runTest() { + hc_entitiessetnameditemns1(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1-expected.txt b/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1-expected.txt new file mode 100644 index 0000000..ac0385f --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_namednodemapinvalidtype1 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1.html b/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1.html new file mode 100644 index 0000000..2ea47cb --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_namednodemapinvalidtype1.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1.js b/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1.js new file mode 100644 index 0000000..0cffa0e --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_namednodemapinvalidtype1.js @@ -0,0 +1,124 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +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); + } + +} + + + + +function runTest() { + hc_namednodemapinvalidtype1(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1-expected.txt b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1-expected.txt new file mode 100644 index 0000000..b9d9923 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize1 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1.html b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1.html new file mode 100644 index 0000000..064fe39 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_nodedocumentfragmentnormalize1.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1.js b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1.js new file mode 100644 index 0000000..dd681a6 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize1.js @@ -0,0 +1,121 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +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); + +} + + + + +function runTest() { + hc_nodedocumentfragmentnormalize1(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2-expected.txt b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2-expected.txt new file mode 100644 index 0000000..4a37f8b --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_nodedocumentfragmentnormalize2 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2.html b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2.html new file mode 100644 index 0000000..9bbbe96 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_nodedocumentfragmentnormalize2.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2.js b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2.js new file mode 100644 index 0000000..23c2e0e --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_nodedocumentfragmentnormalize2.js @@ -0,0 +1,114 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +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); + +} + + + + +function runTest() { + hc_nodedocumentfragmentnormalize2(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1-expected.txt b/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1-expected.txt new file mode 100644 index 0000000..4943221 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_notationsremovenameditemns1 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1.html b/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1.html new file mode 100644 index 0000000..ce2439a --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_notationsremovenameditemns1.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1.js b/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1.js new file mode 100644 index 0000000..0202283 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_notationsremovenameditemns1.js @@ -0,0 +1,141 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_notationsremovenameditemns1"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +An attempt to add remove an notation using removeNamedItemNS should result in +a NO_MODIFICATION_ERR or a NOT_FOUND_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS +*/ +function hc_notationsremovenameditemns1() { + var success; + if(checkInitialization(builder, "hc_notationsremovenameditemns1") != null) return; + var doc; + var notations; + var docType; + var retval; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); + + try { + retval = notations.removeNamedItemNS("http://www.w3.org/1999/xhtml","alpha"); + fail("throw_NO_MOD_OR_NOT_FOUND_ERR"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + case /* NOT_FOUND_ERR */ 8 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + } + +} + + + + +function runTest() { + hc_notationsremovenameditemns1(); +} diff --git a/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1-expected.txt b/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1-expected.txt new file mode 100644 index 0000000..acf55d3 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_notationssetnameditemns1 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1.html b/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1.html new file mode 100644 index 0000000..b09167c --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="hc_notationssetnameditemns1.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1.js b/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1.js new file mode 100644 index 0000000..a2df4f5 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/hc_notationssetnameditemns1.js @@ -0,0 +1,143 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/hc_notationssetnameditemns1"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +An attempt to add an element to the named node map returned by notations should +result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF +* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS +*/ +function hc_notationssetnameditemns1() { + var success; + if(checkInitialization(builder, "hc_notationssetnameditemns1") != null) return; + var doc; + var notations; + var docType; + var retval; + var elem; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docType = doc.doctype; + + + if( + + !( + (builder.contentType == "text/html") +) + + ) { + assertNotNull("docTypeNotNull",docType); +notations = docType.notations; + + assertNotNull("notationsNotNull",notations); +elem = doc.createElementNS("http://www.w3.org/1999/xhtml","br"); + + try { + retval = notations.setNamedItemNS(elem); + fail("throw_HIER_OR_NO_MOD_ERR"); + + } catch (ex) { + if (typeof(ex.code) != 'undefined') { + switch(ex.code) { + case /* HIERARCHY_REQUEST_ERR */ 3 : + break; + case /* NO_MODIFICATION_ALLOWED_ERR */ 7 : + break; + default: + throw ex; + } + } else { + throw ex; + } + } + + } + +} + + + + +function runTest() { + hc_notationssetnameditemns1(); +} diff --git a/LayoutTests/dom/html/level2/core/resources/COPYRIGHT.html b/LayoutTests/dom/html/level2/core/resources/COPYRIGHT.html new file mode 100644 index 0000000..55c385d --- /dev/null +++ b/LayoutTests/dom/html/level2/core/resources/COPYRIGHT.html @@ -0,0 +1,106 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> + <title>W3C IPR SOFTWARE NOTICE</title> +<style type="text/css"> +<!-- +html, body { background: #fff; color: #000; } /* body for Windows IE3 */ +--> +</style> + </head> + <body> + <h1> + W3C IPR SOFTWARE NOTICE + </h1> + <h3> + Copyright © 2002-2004 <a href="http://www.w3.org/">World Wide Web + Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts + Institute of Technology</a>, <a href="http://www.inria.fr/">Institut + National de Recherche en Informatique et en Automatique</a>, <a + href="http://www.keio.ac.jp/">Keio University</a>). All Rights + Reserved. + </h3> + <p> + The DOM Conformance Test Suite for Level 2 core is published under + the W3C Software Copyright Notice and License. The software + license requires "Notice of any changes or modifications to the + W3C files, including the date changes were made." Consequently, + modified versions of the DOM ECMAScript or Java tests must + document that they do not conform to the DOM Conformance Test + Suites; in the case of the Java language binding, the package + names can no longer be in the 'org.w3c' package. + </p> + <p> + <b>Note:</b> The original version of the W3C Software Copyright Notice + and License could be found at <a + href='http://www.w3.org/Consortium/Legal/copyright-software-19980720'>http://www.w3.org/Consortium/Legal/copyright-software-19980720</a> + </p> + <h3> + Copyright © 1994-2004 <a href="http://www.w3.org/">World Wide Web + Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts + Institute of Technology</a>, <a href="http://www.inria.fr/">Institut + National de Recherche en Informatique et en Automatique</a>, <a + href="http://www.keio.ac.jp/">Keio University</a>). All Rights + Reserved. http://www.w3.org/Consortium/Legal/ + </h3> + <p> + This W3C work (including software, documents, or other related items) is + being provided by the copyright holders under the following license. By + obtaining, using and/or copying this work, you (the licensee) agree that + you have read, understood, and will comply with the following terms and + conditions: + </p> + <p> + Permission to use, copy, and modify this software and its documentation, + with or without modification, for any purpose and without fee or + royalty is hereby granted, provided that you include the following on ALL + copies of the software and documentation or portions thereof, including + modifications, that you make: + </p> + <ol> + <li> + The full text of this NOTICE in a location viewable to users of the + redistributed or derivative work. + </li> + <li> + Any pre-existing intellectual property disclaimers, notices, or terms + and conditions. If none exist, a short notice of the following form + (hypertext is preferred, text is permitted) should be used within the + body of any redistributed or derivative code: "Copyright © + [$date-of-software] <a href="http://www.w3.org/">World Wide Web + Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts + Institute of Technology</a>, <a href="http://www.inria.fr/">Institut + National de Recherche en Informatique et en Automatique</a>, <a + href="http://www.keio.ac.jp/">Keio University</a>). All Rights + Reserved. http://www.w3.org/Consortium/Legal/" + </li> + <li> + Notice of any changes or modifications to the W3C files, including the + date changes were made. (We recommend you provide URIs to the location + from which the code is derived.) + </li> + </ol> + <p> + THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT + HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR + DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, + TRADEMARKS OR OTHER RIGHTS. + </p> + <p> + COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR + DOCUMENTATION. + </p> + <p> + The name and trademarks of copyright holders may NOT be used in + advertising or publicity pertaining to the software without specific, + written prior permission. Title to copyright in this software and any + associated documentation will at all times remain with copyright + holders. + </p> + </body> +</html> diff --git a/LayoutTests/dom/html/level2/core/selfhtml.js b/LayoutTests/dom/html/level2/core/selfhtml.js new file mode 100644 index 0000000..06b0cc1 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/selfhtml.js @@ -0,0 +1,721 @@ +/* +Copyright (c) 2001-2005 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C(r) Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + function assertSize(descr, expected, actual) { + var actualSize; + assertNotNull(descr, actual); + actualSize = actual.length; + assertEquals(descr, expected, actualSize); + } + + function assertEqualsAutoCase(context, descr, expected, actual) { + if (builder.contentType == "text/html") { + if(context == "attribute") { + assertEquals(descr, expected.toLowerCase(), actual.toLowerCase()); + } else { + assertEquals(descr, expected.toUpperCase(), actual); + } + } else { + assertEquals(descr, expected, actual); + } + } + + + function assertEqualsCollectionAutoCase(context, descr, expected, actual) { + // + // if they aren't the same size, they aren't equal + assertEquals(descr, expected.length, actual.length); + + // + // if there length is the same, then every entry in the expected list + // must appear once and only once in the actual list + 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) { + assert(descr + ": No match found for " + expectedValue,false); + } + if(matches > 1) { + assert(descr + ": Multiple matches found for " + expectedValue, false); + } + } + } + + function assertEqualsCollection(descr, expected, actual) { + // + // if they aren't the same size, they aren't equal + assertEquals(descr, expected.length, actual.length); + // + // if there length is the same, then every entry in the expected list + // must appear once and only once in the actual list + 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) { + assert(descr + ": No match found for " + expectedValue,false); + } + if(matches > 1) { + assert(descr + ": Multiple matches found for " + expectedValue, false); + } + } + } + + + 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 + assertEquals(descr, expected.length, actual.length); + } + + + 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]) { + assertEquals(descr, expected[i], actual[i]); + } + } + // + // if they aren't the same size, they aren't equal + assertEquals(descr, expected.length, actual.length); + } + + function assertInstanceOf(descr, type, obj) { + if(type == "Attr") { + assertEquals(descr,2,obj.nodeType); + var specd = obj.specified; + } + } + + function assertSame(descr, expected, actual) { + if(expected != actual) { + assertEquals(descr, expected.nodeType, actual.nodeType); + assertEquals(descr, expected.nodeValue, actual.nodeValue); + } + } + + function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) { + // + // URI must be non-null + assertNotNull(assertID, actual); + + 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) assertEquals(assertID,fragment, actualFragment); + + 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) assertEquals(assertID, query, actualQuery); + + 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) { + assertEquals(assertID, scheme, actualScheme); + } + + if(path != null) { + assertEquals(assertID, path, actualPath); + } + + if(host != null) { + var actualHost = ""; + if(actualPath.substring(0,2) == "//") { + var termSlash = actualPath.substring(2).indexOf("/") + 2; + actualHost = actualPath.substring(0,termSlash); + } + assertEquals(assertID, host, actualHost); + } + + if(file != null || name != null) { + var actualFile = actualPath; + var finalSlash = actualPath.lastIndexOf("/"); + if(finalSlash != -1) { + actualFile = actualPath.substring(finalSlash+1); + } + if (file != null) { + assertEquals(assertID, file, actualFile); + } + if (name != null) { + var actualName = actualFile; + var finalDot = actualFile.lastIndexOf("."); + if (finalDot != -1) { + actualName = actualName.substring(0, finalDot); + } + assertEquals(assertID, name, actualName); + } + } + + if(isAbsolute != null) { + assertEquals(assertID, isAbsolute, actualPath.substring(0,1) == "/"); + } + } + + +// size() used by assertSize element +function size(collection) +{ + return collection.length; +} + +function same(expected, actual) +{ + return expected === actual; +} + +function equalsAutoCase(context, expected, actual) { + if (builder.contentType == "text/html") { + if (context == "attribute") { + return expected.toLowerCase() == actual; + } + return expected.toUpperCase() == actual; + } + return expected == actual; +} + +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 < this.allErrors.length; i++) { + if (this.allErrors[i].severity >= severity) { + assertEquals(id, severity - 1, this.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[userDataMonitor.allNotifications.length] = + new UserDataNotification(operation, key, data, src, dst); +} + + + +function HTMLBuilder() { + this.contentType = "text/html"; + this.supportedContentTypes = [ "text/html" ]; + + this.supportsAsyncChange = false; + this.async = false; + this.fixedAttributeNames = [ + "validating", "expandEntityReferences", "coalescing", + "signed", "hasNullString", "ignoringElementContentWhitespace", "namespaceAware", "ignoringComments", "schemaValidating"]; + + this.fixedAttributeValues = [false, true, false, true, true , false, false, false, false ]; + this.configurableAttributeNames = [ ]; + this.configurableAttributeValues = [ ]; + this.initializationError = null; + this.initializationFatalError = null; + this.skipIncompatibleTests = true; + this.documentURLs = new Array(); + this.documentVarnames = new Array(); +} + +HTMLBuilder.prototype.hasFeature = function(feature, version) { + return document.implementation.hasFeature(feature, version); +} + +HTMLBuilder.prototype.getImplementation = function() { + return document.implementation; +} + +HTMLBuilder.prototype.preload = function(frame, varname, url) { + var i; + this.documentVarnames[this.documentVarnames.length] = varname; + this.documentURLs[this.documentURLs.length] = url; + if (this.documentURLs.length > 1) { + // + // if all the urls are not the same + // + for (i = 1; i < this.documentURLs.length; i++) { + if (this.documentURLs[i] != this.documentURLs[0]) { + throw "Tests with multiple loads of different documents are not currently supported"; + } + } + } + return 1; +} + +HTMLBuilder.prototype.cloneNode = function(srcNode, doc) { + var clone = null; + switch(srcNode.nodeType) { + // + // element + case 1: + clone = doc.createElement(srcNode.nodeName.toLowerCase()); + var attrs = srcNode.attributes; + for(var i = 0; i < attrs.length; i++) { + var srcAttr = attrs.item(i); + clone.setAttribute(srcAttr.nodeName, srcAttr.nodeValue); + } + var srcChild = srcNode.firstChild; + while(srcChild != null) { + var cloneChild = this.cloneNode(srcChild, doc); + if (cloneChild != null) { + clone.appendChild(cloneChild); + } + srcChild = srcChild.nextSibling; + } + break; + + case 3: + clone = doc.createTextNode(srcNode.nodeValue); + break; + + case 4: + clone = doc.createCDATASection(srcNode.nodeValue); + break; + + case 7: + clone = doc.createProcessingInstruction(srcNode.nodeValue); + break; + + case 8: + clone = doc.createComment(srcNode.nodeValue); + break; + } + return clone; + +} + + +HTMLBuilder.prototype.load = function(frame, varname, url) { + if (this.documentVarnames[0] == varname) { + return document; + } + // + // + // not a perfect way to do this + // Document.cloneNode is implementation dependent but exists in L1 + // and implemented in IE. The alternative brute force copy + // only works in L2 or higher implementations and can't copy + // entity and notation definitions, etc. + var clone = null; + try { + clone = document.cloneNode(true); + } catch(ex) { + } + if (clone == null) { + clone = document.implementation.createDocument( + document.documentElement.namespaceURI, + document.documentElement.nodeName, + null); + // + // Work-around since + // Safari does not create document element + // create document. + if (clone.documentElement == null) { + clone.appendChild(clone.createElement(document.documentElement.nodeName)); + } + var attrs = document.documentElement.attributes; + for(var i = 0; i < attrs.length; i++) { + var srcAttr = attrs.item(i); + clone.documentElement.setAttribute(srcAttr.nodeName, srcAttr.nodeValue); + } + + var srcNode = document.firstChild; + while(srcNode != null && srcNode.nodeType != 1) { + if (srcNode.nodeType != 10) { + var cloneNode = this.cloneNode(srcNode, clone); + clone.insertBefore(cloneNode, clone.documentElement); + } + srcNode = srcNode.nextSibling; + } + srcNode = document.documentElement.nextSibling; + while(srcNode != null) { + var cloneNode = this.cloneNode(srcNode, clone); + clone.appendChild(cloneNode); + srcNode = srcNode.nextSibling; + } + srcNode = document.documentElement.firstChild; + while(srcNode != null) { + var cloneNode = this.cloneNode(srcNode, clone); + if (cloneNode != null) { + clone.documentElement.appendChild(cloneNode); + } + srcNode = srcNode.nextSibling; + } + } + return clone; +} + +HTMLBuilder.prototype.getImplementationAttribute = function(attr) { + for (var i = 0; i < this.fixedAttributeNames.length; i++) { + if (this.fixedAttributeNames[i] == attr) { + return this.fixedAttributeValues[i]; + } + } + throw "Unrecognized implementation attribute: " + attr; +} + + +HTMLBuilder.prototype.setImplementationAttribute = function(attribute, value) { + var supported = this.getImplementationAttribute(attribute); + if (supported != value) { + this.initializationError = "HTML loader does not support " + attribute + "=" + value; + } +} + +HTMLBuilder.prototype.canSetImplementationAttribute = function(attribute, value) { + var supported = this.getImplementationAttribute(attribute); + return (supported == value); +} + + + + +function createConfiguredBuilder() { + return new HTMLBuilder(); +} + +function catchInitializationError(buildr, ex) { + buildr.initializationError = ex; + buildr.initializationFatalError = ex; +} + +function toLowerArray(src) { + var newArray = new Array(); + var i; + for (i = 0; i < src.length; i++) { + newArray[i] = src[i].toLowerCase(); + } + return newArray; +} + + +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 setResult(resultType, message) { + var testName = getTargetURI(); + document.open(); + document.writeln("<html><head>"); + document.writeln("<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET=utf-8'>"); + document.write("<title>"); + document.write(testName + ":" + resultType); + document.write("</title></head><body><table width='100%' border='1' style='color:"); + if (resultType == null) { + document.writeln("green'><tr><td>Test:</td><td>" + testName + "</td></tr><tr><td>Status:</td><td>Success</td></tr>"); + } else { + if (resultType == "skip") { + document.writeln("blue'><tr><td>Test:</td><td>" + testName + "</td></tr><tr><td>Status:</td><td>Skipped</td></tr>"); + } else { + document.writeln("red'><tr><td>Test:</td><td>" + testName + "</td><td></tr><tr><td>Status:</td><td>" + resultType + "</td></tr>"); + } + } + if (message != null) { + document.writeln("<tr><td>Detail:</td><td>" + message + "</td></tr>"); + } + document.write("</table></body></html>"); + document.close(); + if (parent != window) { + parent.setResult(testName, resultType, message); + } +} + +function checkInitialization(buildr, testname) { + return buildr.initializationError; +} + +function preload(docRef, varname, href) { + return builder.preload(docRef, varname, href); +} + + +function load(docRef, varname, href) { + return builder.load(docRef, varname, href); +} + + +function getImplementationAttribute(attr) { + return builder.getImplementationAttribute(attr); +} + + +function setImplementationAttribute(attribute, value) { + builder.setImplementationAttribute(attribute, value); +} + +function createXPathEvaluator(doc) { + try { + return doc.getFeature("XPath", null); + } + catch(ex) { + } + return doc; +} + + +function getImplementation() { + return builder.getImplementation(); +} + +function assertEquals(id, expected, actual) { + var myActual; + if (expected != actual) { + myActual = actual; + if (actual == null) { + myActual = "null"; + } + throw "failure:" + id + ": assertEquals failed, actual " + myActual + ", expected " + expected + "."; + } +} + +function assertNull(id, actual) { + if (actual != null) { + throw "failure:" + id + ": assertNull failed, actual " + actual; + } +} + + +function assertTrue(id, actual) { + if (!actual) { + throw "failure:" + id + ": assertTrue failed"; + } +} + + +function assertFalse(id, actual) { + if (actual) { + throw "failure:" + id + ": assertTrue failed"; + } +} + +function assertNotNull(id, actual) { + if (actual == null) { + throw "failure:" + id + ": assertNotNull failed"; + } +} + +function fail(id) { + throw "failure:" + id + ": fail"; +} + + + +function getSuffix(contentType) { + switch(contentType) { + case "text/xml": + return ".xml"; + + case "application/xhtml+xml": + return ".xhtml"; + + case "image/svg+xml": + return ".svg"; + + case "text/mathml": + return ".mml"; + } + return ".html"; +} + + +function getResourceURI(name, scheme, contentType) { + var base = document.documentURI; + if (base == null) { + base = ""; + } else { + base = base.substring(0, base.lastIndexOf('/') + 1) + "files/"; + } + return base + name + getSuffix(contentType); +} + + + +function startTest() { + +// +// WebKit modification: 18-August-2005 +// +// Inform the test controller that this test has a text-format result and so should +// be dumped as text, and also that the dump should not occur automatically. +// +if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); +} +// +// End WebKit modification +// + + // + // invoke test setup + // + setUpPage(); + + try { + runTest(); + if (builder.initializationError == null) { + setResult(null, null); + } else { + setResult("skip", builder.initializationError); + } + } catch(ex) { + if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") { + setResult("failure", ex.substring(8)); + } else { + setResult("error", ex); + } + } + +// +// WebKit modification: 18-August-2005 +// +// Inform the test controller that this test is complete, so it's time to dump. +// + if (window.layoutTestController) { + layoutTestController.notifyDone(); + } +// +// End WebKit modification +// + +} diff --git a/LayoutTests/dom/html/level2/core/setAttributeNS10-expected.txt b/LayoutTests/dom/html/level2/core/setAttributeNS10-expected.txt new file mode 100644 index 0000000..9369464 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/setAttributeNS10-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS10 +Status: Success diff --git a/LayoutTests/dom/html/level2/core/setAttributeNS10.html b/LayoutTests/dom/html/level2/core/setAttributeNS10.html new file mode 100644 index 0000000..f72ff36 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/setAttributeNS10.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="selfhtml.js"></script><script charset="UTF-8" type="text/javascript" src="setAttributeNS10.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="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/LayoutTests/dom/html/level2/core/setAttributeNS10.js b/LayoutTests/dom/html/level2/core/setAttributeNS10.js new file mode 100644 index 0000000..c4abed6 --- /dev/null +++ b/LayoutTests/dom/html/level2/core/setAttributeNS10.js @@ -0,0 +1,120 @@ + +/* +Copyright © 2001-2004 World Wide Web Consortium, +(Massachusetts Institute of Technology, European Research Consortium +for Informatics and Mathematics, Keio University). All +Rights Reserved. This work is distributed under the W3C® Software License [1] in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 +*/ + + + + /** + * Gets URI that identifies the test. + * @return uri identifier of test + */ +function getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/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) { + setUpPageStatus = 'complete'; + } + } catch(ex) { + catchInitializationError(builder, ex); + setUpPageStatus = 'complete'; + } +} + + + +// +// This method is called on the completion of +// each asychronous load started in setUpTests. +// +// When every synchronous loaded document has completed, +// the page status is changed which allows the +// body of the test to be executed. +function loadComplete() { + if (++docsLoaded == 1) { + setUpPageStatus = 'complete'; + } +} + + +/** +* +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); + } + +} + + + + +function runTest() { + setAttributeNS10(); +} |