diff options
Diffstat (limited to 'LayoutTests/dom/html/level2/events')
80 files changed, 5309 insertions, 0 deletions
diff --git a/LayoutTests/dom/html/level2/events/DocumentEventCast01-expected.txt b/LayoutTests/dom/html/level2/events/DocumentEventCast01-expected.txt new file mode 100644 index 0000000..90bf30c --- /dev/null +++ b/LayoutTests/dom/html/level2/events/DocumentEventCast01-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/DocumentEventCast01 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/DocumentEventCast01.html b/LayoutTests/dom/html/level2/events/DocumentEventCast01.html new file mode 100644 index 0000000..df15c47 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/DocumentEventCast01.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="DocumentEventCast01.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/events/DocumentEventCast01.js b/LayoutTests/dom/html/level2/events/DocumentEventCast01.js new file mode 100644 index 0000000..ff41750 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/DocumentEventCast01.js @@ -0,0 +1,104 @@ + +/* +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/events/DocumentEventCast01"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + +/** +* +A document is created using implementation.createDocument and +cast to a DocumentEvent interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent +*/ +function DocumentEventCast01() { + var success; + if(checkInitialization(builder, "DocumentEventCast01") != null) return; + var doc; + var docEvent; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + docEvent = doc; + +} + + + + +function runTest() { + DocumentEventCast01(); +} diff --git a/LayoutTests/dom/html/level2/events/EventTargetCast01-expected.txt b/LayoutTests/dom/html/level2/events/EventTargetCast01-expected.txt new file mode 100644 index 0000000..3f8ee6d --- /dev/null +++ b/LayoutTests/dom/html/level2/events/EventTargetCast01-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/EventTargetCast01 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/EventTargetCast01.html b/LayoutTests/dom/html/level2/events/EventTargetCast01.html new file mode 100644 index 0000000..0ea96e7 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/EventTargetCast01.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="EventTargetCast01.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/events/EventTargetCast01.js b/LayoutTests/dom/html/level2/events/EventTargetCast01.js new file mode 100644 index 0000000..574cf0d --- /dev/null +++ b/LayoutTests/dom/html/level2/events/EventTargetCast01.js @@ -0,0 +1,104 @@ + +/* +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/events/EventTargetCast01"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + +/** +* +A document is created using implementation.createDocument and +cast to a EventTarget interface. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget +*/ +function EventTargetCast01() { + var success; + if(checkInitialization(builder, "EventTargetCast01") != null) return; + var doc; + var target; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + target = doc; + +} + + + + +function runTest() { + EventTargetCast01(); +} diff --git a/LayoutTests/dom/html/level2/events/createEvent01-expected.txt b/LayoutTests/dom/html/level2/events/createEvent01-expected.txt new file mode 100644 index 0000000..fd8376e --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent01-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/createEvent01 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/createEvent01.html b/LayoutTests/dom/html/level2/events/createEvent01.html new file mode 100644 index 0000000..b6242a3 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent01.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="createEvent01.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/events/createEvent01.js b/LayoutTests/dom/html/level2/events/createEvent01.js new file mode 100644 index 0000000..da8cf41 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent01.js @@ -0,0 +1,105 @@ + +/* +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/events/createEvent01"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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 object implementing the Event interface is created by using +DocumentEvent.createEvent method with eventType equals "Events". + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent-createEvent +*/ +function createEvent01() { + var success; + if(checkInitialization(builder, "createEvent01") != null) return; + var doc; + var event; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("Events"); + assertNotNull("notnull",event); + +} + + + + +function runTest() { + createEvent01(); +} diff --git a/LayoutTests/dom/html/level2/events/createEvent02-expected.txt b/LayoutTests/dom/html/level2/events/createEvent02-expected.txt new file mode 100644 index 0000000..4b508a8 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent02-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/createEvent02 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/createEvent02.html b/LayoutTests/dom/html/level2/events/createEvent02.html new file mode 100644 index 0000000..791ba7e --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent02.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="createEvent02.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/events/createEvent02.js b/LayoutTests/dom/html/level2/events/createEvent02.js new file mode 100644 index 0000000..a7a1dde --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent02.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/events/createEvent02"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MutationEvents", "2.0"); + + 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 object implementing the Event interface is created by using +DocumentEvent.createEvent method with eventType equals "MutationEvents". +Only applicable if implementation supports MutationEvents. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent-createEvent +*/ +function createEvent02() { + var success; + if(checkInitialization(builder, "createEvent02") != null) return; + var doc; + var event; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("MutationEvents"); + assertNotNull("notnull",event); + +} + + + + +function runTest() { + createEvent02(); +} diff --git a/LayoutTests/dom/html/level2/events/createEvent03-expected.txt b/LayoutTests/dom/html/level2/events/createEvent03-expected.txt new file mode 100644 index 0000000..a07cc99 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent03-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/createEvent03 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/createEvent03.html b/LayoutTests/dom/html/level2/events/createEvent03.html new file mode 100644 index 0000000..475fac9 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent03.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="createEvent03.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/events/createEvent03.js b/LayoutTests/dom/html/level2/events/createEvent03.js new file mode 100644 index 0000000..74d8a34 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent03.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/events/createEvent03"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("UIEvents", "2.0"); + + 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 object implementing the Event interface is created by using +DocumentEvent.createEvent method with eventType equals "UIEvents". +Only applicable if implementation supports the "UIEvents" feature. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent-createEvent +*/ +function createEvent03() { + var success; + if(checkInitialization(builder, "createEvent03") != null) return; + var doc; + var event; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("UIEvents"); + assertNotNull("notnull",event); + +} + + + + +function runTest() { + createEvent03(); +} diff --git a/LayoutTests/dom/html/level2/events/createEvent04-expected.txt b/LayoutTests/dom/html/level2/events/createEvent04-expected.txt new file mode 100644 index 0000000..d4a1db9 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent04-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/createEvent04 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/createEvent04.html b/LayoutTests/dom/html/level2/events/createEvent04.html new file mode 100644 index 0000000..fc6b672 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent04.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="createEvent04.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/events/createEvent04.js b/LayoutTests/dom/html/level2/events/createEvent04.js new file mode 100644 index 0000000..4d0fce5 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent04.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/events/createEvent04"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MouseEvents", "2.0"); + + 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 object implementing the Event interface is created by using +DocumentEvent.createEvent method with eventType equals "UIEvents". +Only applicable if implementation supports the "UIEvents" feature. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent-createEvent +*/ +function createEvent04() { + var success; + if(checkInitialization(builder, "createEvent04") != null) return; + var doc; + var event; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("MouseEvents"); + assertNotNull("notnull",event); + +} + + + + +function runTest() { + createEvent04(); +} diff --git a/LayoutTests/dom/html/level2/events/createEvent05-expected.txt b/LayoutTests/dom/html/level2/events/createEvent05-expected.txt new file mode 100644 index 0000000..b0a49e9 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent05-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/createEvent05 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/createEvent05.html b/LayoutTests/dom/html/level2/events/createEvent05.html new file mode 100644 index 0000000..2c172d4 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent05.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="createEvent05.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/events/createEvent05.js b/LayoutTests/dom/html/level2/events/createEvent05.js new file mode 100644 index 0000000..089952f --- /dev/null +++ b/LayoutTests/dom/html/level2/events/createEvent05.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/events/createEvent05"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("HTMLEvents", "2.0"); + + 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 object implementing the Event interface is created by using +DocumentEvent.createEvent method with eventType equals "HTMLEvents". +Only applicable if implementation supports the "HTMLEvents" feature. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent-createEvent +*/ +function createEvent05() { + var success; + if(checkInitialization(builder, "createEvent05") != null) return; + var doc; + var event; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("HTMLEvents"); + assertNotNull("notnull",event); + +} + + + + +function runTest() { + createEvent05(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent01-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent01-expected.txt new file mode 100644 index 0000000..4e23791 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent01-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent01 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent01.html b/LayoutTests/dom/html/level2/events/dispatchEvent01.html new file mode 100644 index 0000000..322d85c --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent01.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="dispatchEvent01.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/events/dispatchEvent01.js b/LayoutTests/dom/html/level2/events/dispatchEvent01.js new file mode 100644 index 0000000..a8a2204 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent01.js @@ -0,0 +1,118 @@ + +/* +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/events/dispatchEvent01"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + +/** +* +A null reference is passed to EventTarget.dispatchEvent(), should raise implementation +or platform exception. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-17189187 +*/ +function dispatchEvent01() { + var success; + if(checkInitialization(builder, "dispatchEvent01") != null) return; + var doc; + var target; + var evt = null; + + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + + } catch (ex) { + success = true; + } + assertTrue("throw_ImplException", success); + } + +} + + + + +function runTest() { + dispatchEvent01(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt new file mode 100644 index 0000000..0be1d2c --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent02.html b/LayoutTests/dom/html/level2/events/dispatchEvent02.html new file mode 100644 index 0000000..9436c2c --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent02.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="dispatchEvent02.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/events/dispatchEvent02.js b/LayoutTests/dom/html/level2/events/dispatchEvent02.js new file mode 100644 index 0000000..1a46d48 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent02.js @@ -0,0 +1,118 @@ + +/* +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/events/dispatchEvent02"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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 created but not initialized event is passed to EventTarget.dispatchEvent(). Should raise +UNSPECIFIED_EVENT_TYPE_ERR EventException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent02() { + var success; + if(checkInitialization(builder, "dispatchEvent02") != null) return; + var doc; + var target; + var evt; + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + evt = doc.createEvent("Events"); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 0); + } + assertTrue("throw_UNSPECIFIED_EVENT_TYPE_ERR",success); + } + +} + + + + +function runTest() { + dispatchEvent02(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt new file mode 100644 index 0000000..cd06d61 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent03.html b/LayoutTests/dom/html/level2/events/dispatchEvent03.html new file mode 100644 index 0000000..6b210b4 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent03.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="dispatchEvent03.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/events/dispatchEvent03.js b/LayoutTests/dom/html/level2/events/dispatchEvent03.js new file mode 100644 index 0000000..a615d16 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent03.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/events/dispatchEvent03"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MutationEvents", "2.0"); + + 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 created but not initialized event is passed to EventTarget.dispatchEvent(). Should raise +UNSPECIFIED_EVENT_TYPE_ERR EventException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent03() { + var success; + if(checkInitialization(builder, "dispatchEvent03") != null) return; + var doc; + var target; + var evt; + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + evt = doc.createEvent("MutationEvents"); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 0); + } + assertTrue("throw_UNSPECIFIED_EVENT_TYPE_ERR",success); + } + +} + + + + +function runTest() { + dispatchEvent03(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt new file mode 100644 index 0000000..c44cd14 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent04.html b/LayoutTests/dom/html/level2/events/dispatchEvent04.html new file mode 100644 index 0000000..7707570 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent04.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="dispatchEvent04.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/events/dispatchEvent04.js b/LayoutTests/dom/html/level2/events/dispatchEvent04.js new file mode 100644 index 0000000..628be89 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent04.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/events/dispatchEvent04"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("UIEvents", "2.0"); + + 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 created but not initialized event is passed to EventTarget.dispatchEvent(). Should raise +UNSPECIFIED_EVENT_TYPE_ERR EventException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent04() { + var success; + if(checkInitialization(builder, "dispatchEvent04") != null) return; + var doc; + var target; + var evt; + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + evt = doc.createEvent("UIEvents"); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 0); + } + assertTrue("throw_UNSPECIFIED_EVENT_TYPE_ERR",success); + } + +} + + + + +function runTest() { + dispatchEvent04(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt new file mode 100644 index 0000000..4e9d0fd --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent05.html b/LayoutTests/dom/html/level2/events/dispatchEvent05.html new file mode 100644 index 0000000..41824ec --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent05.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="dispatchEvent05.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/events/dispatchEvent05.js b/LayoutTests/dom/html/level2/events/dispatchEvent05.js new file mode 100644 index 0000000..1a5953f --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent05.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/events/dispatchEvent05"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MouseEvents", "2.0"); + + 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 created but not initialized event is passed to EventTarget.dispatchEvent(). Should raise +UNSPECIFIED_EVENT_TYPE_ERR EventException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent05() { + var success; + if(checkInitialization(builder, "dispatchEvent05") != null) return; + var doc; + var target; + var evt; + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + evt = doc.createEvent("MouseEvents"); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 0); + } + assertTrue("throw_UNSPECIFIED_EVENT_TYPE_ERR",success); + } + +} + + + + +function runTest() { + dispatchEvent05(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt new file mode 100644 index 0000000..c832234 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent06.html b/LayoutTests/dom/html/level2/events/dispatchEvent06.html new file mode 100644 index 0000000..c5e8844 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent06.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="dispatchEvent06.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/events/dispatchEvent06.js b/LayoutTests/dom/html/level2/events/dispatchEvent06.js new file mode 100644 index 0000000..720fe46 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent06.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/events/dispatchEvent06"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("HTMLEvents", "2.0"); + + 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 created but not initialized event is passed to EventTarget.dispatchEvent(). Should raise +UNSPECIFIED_EVENT_TYPE_ERR EventException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent06() { + var success; + if(checkInitialization(builder, "dispatchEvent06") != null) return; + var doc; + var target; + var evt; + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + evt = doc.createEvent("HTMLEvents"); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 0); + } + assertTrue("throw_UNSPECIFIED_EVENT_TYPE_ERR",success); + } + +} + + + + +function runTest() { + dispatchEvent06(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt new file mode 100644 index 0000000..f941adb --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent07.html b/LayoutTests/dom/html/level2/events/dispatchEvent07.html new file mode 100644 index 0000000..18b5d34 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent07.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="dispatchEvent07.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/events/dispatchEvent07.js b/LayoutTests/dom/html/level2/events/dispatchEvent07.js new file mode 100644 index 0000000..9a0c5c7 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent07.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/events/dispatchEvent07"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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 Event initialized with a empty name is passed to EventTarget.dispatchEvent(). Should raise +UNSPECIFIED_EVENT_TYPE_ERR EventException. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent07() { + var success; + if(checkInitialization(builder, "dispatchEvent07") != null) return; + var doc; + var target; + var evt; + var preventDefault; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + evt = doc.createEvent("Events"); + evt.initEvent("",false,false); + + { + success = false; + try { + preventDefault = doc.dispatchEvent(evt); + } + catch(ex) { + success = (typeof(ex.code) != 'undefined' && ex.code == 0); + } + assertTrue("throw_UNSPECIFIED_EVENT_TYPE_ERR",success); + } + +} + + + + +function runTest() { + dispatchEvent07(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent08-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent08-expected.txt new file mode 100644 index 0000000..23e9af1 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent08-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent08 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent08.html b/LayoutTests/dom/html/level2/events/dispatchEvent08.html new file mode 100644 index 0000000..3f4f426 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent08.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="dispatchEvent08.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/events/dispatchEvent08.js b/LayoutTests/dom/html/level2/events/dispatchEvent08.js new file mode 100644 index 0000000..67500d7 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent08.js @@ -0,0 +1,126 @@ + +/* +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/events/dispatchEvent08"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + +//EventMonitor's require a document level variable named monitor +var monitor; + +/** +* +An EventListener registered on the target node with capture false, should +recieve any event fired on that node. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent08() { + var success; + if(checkInitialization(builder, "dispatchEvent08") != null) return; + var doc; + var target; + var evt; + var preventDefault; + monitor = new EventMonitor(); + + var atEvents = new Array(); + + var bubbledEvents = new Array(); + + var capturedEvents = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + doc.addEventListener("foo", monitor.handleEvent, false); + evt = doc.createEvent("Events"); + evt.initEvent("foo",true,false); + preventDefault = doc.dispatchEvent(evt); + atEvents = monitor.atEvents; +assertSize("atCount",1,atEvents); +bubbledEvents = monitor.bubbledEvents; +assertSize("bubbleCount",0,bubbledEvents); +capturedEvents = monitor.capturedEvents; +assertSize("captureCount",0,capturedEvents); + +} + + + + +function runTest() { + dispatchEvent08(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent09-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent09-expected.txt new file mode 100644 index 0000000..413ef99 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent09-expected.txt @@ -0,0 +1,3 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent09 +Status: failure +Detail: atCount: assertEquals failed, actual 1, expected 0. diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent09.html b/LayoutTests/dom/html/level2/events/dispatchEvent09.html new file mode 100644 index 0000000..789a277 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent09.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="dispatchEvent09.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/events/dispatchEvent09.js b/LayoutTests/dom/html/level2/events/dispatchEvent09.js new file mode 100644 index 0000000..8e744b4 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent09.js @@ -0,0 +1,126 @@ + +/* +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/events/dispatchEvent09"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + +//EventMonitor's require a document level variable named monitor +var monitor; + +/** +* +An event is dispatched to the document with a capture listener attached. +A capturing EventListener will not be triggered by events dispatched directly to the EventTarget upon which it is registered. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent09() { + var success; + if(checkInitialization(builder, "dispatchEvent09") != null) return; + var doc; + var target; + var evt; + var preventDefault; + monitor = new EventMonitor(); + + var atEvents = new Array(); + + var bubbledEvents = new Array(); + + var capturedEvents = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + doc.addEventListener("foo", monitor.handleEvent, true); + evt = doc.createEvent("Events"); + evt.initEvent("foo",true,false); + preventDefault = doc.dispatchEvent(evt); + atEvents = monitor.atEvents; +assertSize("atCount",0,atEvents); +bubbledEvents = monitor.bubbledEvents; +assertSize("bubbleCount",0,bubbledEvents); +capturedEvents = monitor.capturedEvents; +assertSize("captureCount",0,capturedEvents); + +} + + + + +function runTest() { + dispatchEvent09(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent10-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent10-expected.txt new file mode 100644 index 0000000..4615680 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent10-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent10 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent10.html b/LayoutTests/dom/html/level2/events/dispatchEvent10.html new file mode 100644 index 0000000..bce5934 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent10.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="dispatchEvent10.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/events/dispatchEvent10.js b/LayoutTests/dom/html/level2/events/dispatchEvent10.js new file mode 100644 index 0000000..184b11f --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent10.js @@ -0,0 +1,127 @@ + +/* +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/events/dispatchEvent10"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + +//EventMonitor's require a document level variable named monitor +var monitor; + +/** +* +The same monitor is registered twice and an event is dispatched. The monitor should +recieve only one handleEvent call. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent10() { + var success; + if(checkInitialization(builder, "dispatchEvent10") != null) return; + var doc; + var target; + var evt; + var preventDefault; + monitor = new EventMonitor(); + + var atEvents = new Array(); + + var bubbledEvents = new Array(); + + var capturedEvents = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + doc.addEventListener("foo", monitor.handleEvent, false); + doc.addEventListener("foo", monitor.handleEvent, false); + evt = doc.createEvent("Events"); + evt.initEvent("foo",true,false); + preventDefault = doc.dispatchEvent(evt); + atEvents = monitor.atEvents; +assertSize("atCount",1,atEvents); +bubbledEvents = monitor.bubbledEvents; +assertSize("bubbleCount",0,bubbledEvents); +capturedEvents = monitor.capturedEvents; +assertSize("captureCount",0,capturedEvents); + +} + + + + +function runTest() { + dispatchEvent10(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent11-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent11-expected.txt new file mode 100644 index 0000000..bfc7703 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent11-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent11 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent11.html b/LayoutTests/dom/html/level2/events/dispatchEvent11.html new file mode 100644 index 0000000..6ab5fe3 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent11.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="dispatchEvent11.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/events/dispatchEvent11.js b/LayoutTests/dom/html/level2/events/dispatchEvent11.js new file mode 100644 index 0000000..e93ac56 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent11.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/events/dispatchEvent11"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + +//EventMonitor's require a document level variable named monitor +var monitor; + +/** +* +The same monitor is registered twice, removed once, and an event is dispatched. +The monitor should recieve only no handleEvent calls. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent11() { + var success; + if(checkInitialization(builder, "dispatchEvent11") != null) return; + var doc; + var target; + var evt; + var preventDefault; + monitor = new EventMonitor(); + + var events = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + doc.addEventListener("foo", monitor.handleEvent, false); + doc.addEventListener("foo", monitor.handleEvent, false); + doc.removeEventListener("foo", monitor.handleEvent, false); + evt = doc.createEvent("Events"); + evt.initEvent("foo",true,false); + preventDefault = doc.dispatchEvent(evt); + events = monitor.allEvents; +assertSize("eventCount",0,events); + +} + + + + +function runTest() { + dispatchEvent11(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent12-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent12-expected.txt new file mode 100644 index 0000000..a241a22 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent12-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent12 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent12.html b/LayoutTests/dom/html/level2/events/dispatchEvent12.html new file mode 100644 index 0000000..1393f49 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent12.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="dispatchEvent12.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/events/dispatchEvent12.js b/LayoutTests/dom/html/level2/events/dispatchEvent12.js new file mode 100644 index 0000000..edfdfd5 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent12.js @@ -0,0 +1,151 @@ + +/* +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/events/dispatchEvent12"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + +//EventMonitor's require a document level variable named monitor +var monitor; + + /** + * Inner class implementation for variable other + */ +var other; + +/** + * Constructor + + */ + +function EventListenerN10035() { + } + + /** + * +This method is called whenever an event occurs of the type for which theEventListenerinterface was registered. + + * @param evt +TheEventcontains contextual information about the event. It also contains thestopPropagationand preventDefaultmethods which are used in determining the event's flow and default action. + + */ +EventListenerN10035.prototype.handleEvent = function(evt) { + // + // bring class variables into function scope + // + } + +/** +* +A monitor is added, multiple calls to removeEventListener +are mde with similar but not identical arguments, and an event is dispatched. +The monitor should recieve handleEvent calls. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent12() { + var success; + if(checkInitialization(builder, "dispatchEvent12") != null) return; + var doc; + var target; + var evt; + var preventDefault; + monitor = new EventMonitor(); + + other = new EventListenerN10035(); + + var events = new Array(); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + doc.addEventListener("foo", monitor.handleEvent, false); + doc.removeEventListener("foo", monitor.handleEvent, true); + doc.removeEventListener("food", monitor.handleEvent, false); + doc.removeEventListener("foo", other.handleEvent, false); + evt = doc.createEvent("Events"); + evt.initEvent("foo",true,false); + preventDefault = doc.dispatchEvent(evt); + events = monitor.allEvents; +assertSize("eventCount",1,events); + +} + + + + +function runTest() { + dispatchEvent12(); +} diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent13-expected.txt b/LayoutTests/dom/html/level2/events/dispatchEvent13-expected.txt new file mode 100644 index 0000000..e0cbd7f --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent13-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent13 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/dispatchEvent13.html b/LayoutTests/dom/html/level2/events/dispatchEvent13.html new file mode 100644 index 0000000..b66aed4 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent13.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="dispatchEvent13.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/events/dispatchEvent13.js b/LayoutTests/dom/html/level2/events/dispatchEvent13.js new file mode 100644 index 0000000..bf3923f --- /dev/null +++ b/LayoutTests/dom/html/level2/events/dispatchEvent13.js @@ -0,0 +1,209 @@ + +/* +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/events/dispatchEvent13"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + + /** + * Inner class implementation for variable listener1 + */ +var listener1; + +/** + * Constructor + + * @param events Value from value attribute of nested var element + * @param listeners Value from value attribute of nested var element + */ + +function EventListenerN1003B(events, listeners) { + this.events = events; + this.listeners = listeners; + } + + /** + * +This method is called whenever an event occurs of the type for which theEventListenerinterface was registered. + + * @param evt +TheEventcontains contextual information about the event. It also contains thestopPropagationand preventDefaultmethods which are used in determining the event's flow and default action. + + */ +EventListenerN1003B.prototype.handleEvent = function(evt) { + // + // bring class variables into function scope + // + var events = listener1.events; + var listeners = listener1.listeners; + var target; + var listener; + events[events.length] = evt; +target = evt.currentTarget; + + for(var indexN10065 = 0;indexN10065 < listeners.length; indexN10065++) { + listener = listeners[indexN10065]; + target.removeEventListener("foo", listener.handleEvent, false); + + } + } + + /** + * Inner class implementation for variable listener2 + */ +var listener2; + +/** + * Constructor + + * @param events Value from value attribute of nested var element + * @param listeners Value from value attribute of nested var element + */ + +function EventListenerN10074(events, listeners) { + this.events = events; + this.listeners = listeners; + } + + /** + * +This method is called whenever an event occurs of the type for which theEventListenerinterface was registered. + + * @param evt +TheEventcontains contextual information about the event. It also contains thestopPropagationand preventDefaultmethods which are used in determining the event's flow and default action. + + */ +EventListenerN10074.prototype.handleEvent = function(evt) { + // + // bring class variables into function scope + // + var events = listener2.events; + var listeners = listener2.listeners; + var target; + var listener; + events[events.length] = evt; +target = evt.currentTarget; + + for(var indexN10098 = 0;indexN10098 < listeners.length; indexN10098++) { + listener = listeners[indexN10098]; + target.removeEventListener("foo", listener.handleEvent, false); + + } + } + +/** +* +Two listeners are registered on the same target, each of which will remove both itself and +the other on the first event. Only one should see the event since event listeners +can never be invoked after being removed. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#xpointer(id('Events-EventTarget-dispatchEvent')/raises/exception[@name='EventException']/descr/p[substring-before(.,':')='UNSPECIFIED_EVENT_TYPE_ERR']) +*/ +function dispatchEvent13() { + var success; + if(checkInitialization(builder, "dispatchEvent13") != null) return; + var doc; + var target; + var evt; + var preventDefault; + var listeners = new Array(); + + var events = new Array(); + + listener1 = new EventListenerN1003B(events, listeners); + + listener2 = new EventListenerN10074(events, listeners); + + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + listeners[listeners.length] = listener1; +listeners[listeners.length] = listener2; +doc.addEventListener("foo", listener1.handleEvent, false); + doc.addEventListener("foo", listener2.handleEvent, false); + evt = doc.createEvent("Events"); + evt.initEvent("foo",true,false); + preventDefault = doc.dispatchEvent(evt); + assertSize("eventCount",1,events); + +} + + + + +function runTest() { + dispatchEvent13(); +} diff --git a/LayoutTests/dom/html/level2/events/initEvent01-expected.txt b/LayoutTests/dom/html/level2/events/initEvent01-expected.txt new file mode 100644 index 0000000..7693f61 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent01-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/initEvent01 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/initEvent01.html b/LayoutTests/dom/html/level2/events/initEvent01.html new file mode 100644 index 0000000..8cde89f --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent01.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="initEvent01.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/events/initEvent01.js b/LayoutTests/dom/html/level2/events/initEvent01.js new file mode 100644 index 0000000..b9346e7 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent01.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/events/initEvent01"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + +/** +* +The Event.initEvent method is called for event returned by DocumentEvent.createEvent("events") +and the state is checked to see if it reflects the parameters. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent +*/ +function initEvent01() { + var success; + if(checkInitialization(builder, "initEvent01") != null) return; + var doc; + var event; + var expectedEventType = "rotate"; + var actualEventType; + var expectedCanBubble = true; + var actualCanBubble; + var expectedCancelable = false; + var actualCancelable; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("Events"); + assertNotNull("notnull",event); +event.initEvent(expectedEventType,expectedCanBubble,expectedCancelable); + actualEventType = event.type; + + assertEquals("type",expectedEventType,actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable",expectedCancelable,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble",expectedCanBubble,actualCanBubble); + +} + + + + +function runTest() { + initEvent01(); +} diff --git a/LayoutTests/dom/html/level2/events/initEvent02-expected.txt b/LayoutTests/dom/html/level2/events/initEvent02-expected.txt new file mode 100644 index 0000000..1889794 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent02-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/initEvent02 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/initEvent02.html b/LayoutTests/dom/html/level2/events/initEvent02.html new file mode 100644 index 0000000..a55d144 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent02.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="initEvent02.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/events/initEvent02.js b/LayoutTests/dom/html/level2/events/initEvent02.js new file mode 100644 index 0000000..78275c5 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent02.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/events/initEvent02"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + +/** +* +The Event.initEvent method is called for event returned by DocumentEvent.createEvent("events") +and the state is checked to see if it reflects the parameters. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent +*/ +function initEvent02() { + var success; + if(checkInitialization(builder, "initEvent02") != null) return; + var doc; + var event; + var expectedEventType = "rotate"; + var actualEventType; + var expectedCanBubble = false; + var actualCanBubble; + var expectedCancelable = true; + var actualCancelable; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("Events"); + assertNotNull("notnull",event); +event.initEvent(expectedEventType,expectedCanBubble,expectedCancelable); + actualEventType = event.type; + + assertEquals("type",expectedEventType,actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable",expectedCancelable,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble",expectedCanBubble,actualCanBubble); + +} + + + + +function runTest() { + initEvent02(); +} diff --git a/LayoutTests/dom/html/level2/events/initEvent03-expected.txt b/LayoutTests/dom/html/level2/events/initEvent03-expected.txt new file mode 100644 index 0000000..85ccb1d --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent03-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/initEvent03 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/initEvent03.html b/LayoutTests/dom/html/level2/events/initEvent03.html new file mode 100644 index 0000000..0b6b0f0 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent03.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="initEvent03.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/events/initEvent03.js b/LayoutTests/dom/html/level2/events/initEvent03.js new file mode 100644 index 0000000..3143971 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent03.js @@ -0,0 +1,130 @@ + +/* +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/events/initEvent03"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test 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'; + } +} + + +/** +* +The Event.initEvent method is called for event returned by DocumentEvent.createEvent("events") +and the state is checked to see if it reflects the parameters. initEvent may be +called multiple times and the last time is definitive. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent +*/ +function initEvent03() { + var success; + if(checkInitialization(builder, "initEvent03") != null) return; + var doc; + var event; + var expectedEventType = "rotate"; + var actualEventType; + var actualCanBubble; + var actualCancelable; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("Events"); + assertNotNull("notnull",event); +event.initEvent("rotate",true,true); + actualEventType = event.type; + + assertEquals("type","rotate",actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable",true,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble",true,actualCanBubble); + event.initEvent("shear",false,false); + actualEventType = event.type; + + assertEquals("type2","shear",actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable2",false,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble2",false,actualCanBubble); + +} + + + + +function runTest() { + initEvent03(); +} diff --git a/LayoutTests/dom/html/level2/events/initEvent04-expected.txt b/LayoutTests/dom/html/level2/events/initEvent04-expected.txt new file mode 100644 index 0000000..a90cab3 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent04-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/initEvent04 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/initEvent04.html b/LayoutTests/dom/html/level2/events/initEvent04.html new file mode 100644 index 0000000..96da0f1 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent04.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="initEvent04.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/events/initEvent04.js b/LayoutTests/dom/html/level2/events/initEvent04.js new file mode 100644 index 0000000..0136e07 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent04.js @@ -0,0 +1,123 @@ + +/* +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/events/initEvent04"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MutationEvents", "2.0"); + + 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'; + } +} + + +/** +* +The Event.initEvent method is called for event returned by +DocumentEvent.createEvent("MutationEvents") +and the state is checked to see if it reflects the parameters. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent +*/ +function initEvent04() { + var success; + if(checkInitialization(builder, "initEvent04") != null) return; + var doc; + var event; + var expectedEventType = "rotate"; + var actualEventType; + var expectedCanBubble = true; + var actualCanBubble; + var expectedCancelable = false; + var actualCancelable; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("MutationEvents"); + assertNotNull("notnull",event); +event.initEvent(expectedEventType,expectedCanBubble,expectedCancelable); + actualEventType = event.type; + + assertEquals("type",expectedEventType,actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable",expectedCancelable,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble",expectedCanBubble,actualCanBubble); + +} + + + + +function runTest() { + initEvent04(); +} diff --git a/LayoutTests/dom/html/level2/events/initEvent05-expected.txt b/LayoutTests/dom/html/level2/events/initEvent05-expected.txt new file mode 100644 index 0000000..ee70b47 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent05-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/initEvent05 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/initEvent05.html b/LayoutTests/dom/html/level2/events/initEvent05.html new file mode 100644 index 0000000..fe34b10 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent05.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="initEvent05.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/events/initEvent05.js b/LayoutTests/dom/html/level2/events/initEvent05.js new file mode 100644 index 0000000..e2abb95 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent05.js @@ -0,0 +1,123 @@ + +/* +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/events/initEvent05"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MutationEvents", "2.0"); + + 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'; + } +} + + +/** +* +The Event.initEvent method is called for event returned by +DocumentEvent.createEvent("MutationEvents") +and the state is checked to see if it reflects the parameters. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent +*/ +function initEvent05() { + var success; + if(checkInitialization(builder, "initEvent05") != null) return; + var doc; + var event; + var expectedEventType = "rotate"; + var actualEventType; + var expectedCanBubble = false; + var actualCanBubble; + var expectedCancelable = true; + var actualCancelable; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("MutationEvents"); + assertNotNull("notnull",event); +event.initEvent(expectedEventType,expectedCanBubble,expectedCancelable); + actualEventType = event.type; + + assertEquals("type",expectedEventType,actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable",expectedCancelable,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble",expectedCanBubble,actualCanBubble); + +} + + + + +function runTest() { + initEvent05(); +} diff --git a/LayoutTests/dom/html/level2/events/initEvent06-expected.txt b/LayoutTests/dom/html/level2/events/initEvent06-expected.txt new file mode 100644 index 0000000..e5090ec --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent06-expected.txt @@ -0,0 +1,2 @@ +Test: http://www.w3.org/2001/DOM-Test-Suite/level2/events/initEvent06 +Status: Success diff --git a/LayoutTests/dom/html/level2/events/initEvent06.html b/LayoutTests/dom/html/level2/events/initEvent06.html new file mode 100644 index 0000000..88ef849 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent06.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="initEvent06.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/events/initEvent06.js b/LayoutTests/dom/html/level2/events/initEvent06.js new file mode 100644 index 0000000..1c8d5bb --- /dev/null +++ b/LayoutTests/dom/html/level2/events/initEvent06.js @@ -0,0 +1,132 @@ + +/* +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/events/initEvent06"; + } + +var docsLoaded = -1000000; +var builder = null; + +// +// This function is called by the testing framework before +// running the test suite. +// +// If there are no configuration exceptions, asynchronous +// document loading is started. Otherwise, the status +// is set to complete and the exception is immediately +// raised when entering the body of the test. +// +function setUpPage() { + setUpPageStatus = 'running'; + try { + // + // creates test document builder, may throw exception + // + builder = createConfiguredBuilder(); + checkFeature("MutationEvents", "2.0"); + + 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'; + } +} + + +/** +* +The Event.initEvent method is called for event returned by +DocumentEvent.createEvent("MutationEvents") +and the state is checked to see if it reflects the parameters. initEvent may be +called multiple times and the last time is definitive. + +* @author Curt Arnold +* @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent +*/ +function initEvent06() { + var success; + if(checkInitialization(builder, "initEvent06") != null) return; + var doc; + var event; + var expectedEventType = "rotate"; + var actualEventType; + var actualCanBubble; + var actualCancelable; + + var docRef = null; + if (typeof(this.doc) != 'undefined') { + docRef = this.doc; + } + doc = load(docRef, "doc", "hc_staff"); + event = doc.createEvent("MutationEvents"); + assertNotNull("notnull",event); +event.initEvent("rotate",true,true); + actualEventType = event.type; + + assertEquals("type","rotate",actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable",true,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble",true,actualCanBubble); + event.initEvent("shear",false,false); + actualEventType = event.type; + + assertEquals("type2","shear",actualEventType); + actualCancelable = event.cancelable; + + assertEquals("cancelable2",false,actualCancelable); + actualCanBubble = event.bubbles; + + assertEquals("canBubble2",false,actualCanBubble); + +} + + + + +function runTest() { + initEvent06(); +} diff --git a/LayoutTests/dom/html/level2/events/resources/COPYRIGHT.html b/LayoutTests/dom/html/level2/events/resources/COPYRIGHT.html new file mode 100644 index 0000000..abf8b73 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/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 events 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/events/selfhtml.js b/LayoutTests/dom/html/level2/events/selfhtml.js new file mode 100644 index 0000000..06b0cc1 --- /dev/null +++ b/LayoutTests/dom/html/level2/events/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 +// + +} |